Kill e-cursor(s) (both of them).

This commit is contained in:
Matthew Barnes
2009-11-09 20:40:07 -05:00
parent bd5d405fe3
commit 5beeca1f80
20 changed files with 42 additions and 583 deletions

View File

@ -40,7 +40,6 @@
#include "misc/e-dateedit.h"
#include "e-util/e-binding.h"
#include "e-util/e-cursor.h"
#include "e-util/e-util.h"
#include "e-meeting-utils.h"
@ -1386,8 +1385,16 @@ e_meeting_time_selector_refresh_cb (gpointer data)
EMeetingTimeSelector *mts = data;
if (e_meeting_store_get_num_queries (mts->model) == 0) {
e_cursor_set ((GtkWidget *)mts, E_CURSOR_NORMAL);
GdkCursor *cursor;
GdkWindow *window;
cursor = gdk_cursor_new (GDK_LEFT_PTR);
window = gtk_widget_get_window (GTK_WIDGET (mts));
gdk_window_set_cursor (window, cursor);
gdk_cursor_unref (cursor);
mts->last_cursor_set = GDK_LEFT_PTR;
e_meeting_time_selector_item_set_normal_cursor (E_MEETING_TIME_SELECTOR_ITEM (mts->item_top));
e_meeting_time_selector_item_set_normal_cursor (E_MEETING_TIME_SELECTOR_ITEM (mts->item_main));
}
@ -1406,6 +1413,8 @@ void
e_meeting_time_selector_refresh_free_busy (EMeetingTimeSelector *mts, gint row, gboolean all)
{
EMeetingTime start, end;
GdkCursor *cursor;
GdkWindow *window;
start = mts->meeting_start_time;
g_date_subtract_days (&start.date, E_MEETING_TIME_SELECTOR_FB_DAYS_BEFORE);
@ -1418,7 +1427,11 @@ e_meeting_time_selector_refresh_free_busy (EMeetingTimeSelector *mts, gint row,
/* set the cursor to Busy, We need to reset it to normal once the free busy
queries are complete */
e_cursor_set ((GtkWidget *)mts, E_CURSOR_BUSY);
cursor = gdk_cursor_new (GDK_WATCH);
window = gtk_widget_get_window (GTK_WIDGET (mts));
gdk_window_set_cursor (window, cursor);
gdk_cursor_unref (cursor);
mts->last_cursor_set = GDK_WATCH;
/* Ref ourselves in case we are called back after destruction,

View File

@ -573,8 +573,6 @@ e_util_guess_mime_type
e_util_read_file
e_util_get_category_filter_options
e_charset_add_radio_actions
ECursorType
e_cursor_set
e_folder_map_local_folders
e_fsutils_usage
e_fsutils_avail

View File

@ -378,36 +378,6 @@ Miscellaneous Utility Functions
@Returns:
<!-- ##### ENUM ECursorType ##### -->
<para>
</para>
@E_CURSOR_FAT_CROSS:
@E_CURSOR_THIN_CROSS:
@E_CURSOR_ARROW:
@E_CURSOR_MOVE:
@E_CURSOR_ZOOM_IN:
@E_CURSOR_ZOOM_OUT:
@E_CURSOR_SIZE_X:
@E_CURSOR_SIZE_Y:
@E_CURSOR_SIZE_TL:
@E_CURSOR_SIZE_TR:
@E_CURSOR_PRESS:
@E_CURSOR_HAND_OPEN:
@E_CURSOR_HAND_CLOSED:
@E_CURSOR_XTERM:
@E_CURSOR_NUM_CURSORS:
<!-- ##### FUNCTION e_cursor_set ##### -->
<para>
</para>
@widget:
@cursor:
<!-- ##### FUNCTION e_folder_map_local_folders ##### -->
<para>

View File

@ -406,6 +406,14 @@ EvolutionIntelligentImporter
intelligent
<!-- ##### ENUM ECursorType ##### -->
<para>
</para>
@E_CURSOR_NORMAL:
@E_CURSOR_BUSY:
<!-- ##### STRUCT ESEvent ##### -->
<para>
@ -1850,6 +1858,14 @@ intelligent
@revision:
@Returns:
<!-- ##### FUNCTION e_cursor_set ##### -->
<para>
</para>
@widget:
@cursor:
<!-- ##### FUNCTION e_file_dialog_save ##### -->
<para>

View File

@ -18,7 +18,6 @@ eutilinclude_HEADERS = \
e-categories-config.h \
e-charset.h \
e-config.h \
e-cursor.h \
e-datetime-format.h \
e-dialog-utils.h \
e-dialog-widgets.h \
@ -92,7 +91,6 @@ libeutil_la_SOURCES = \
e-categories-config.c \
e-charset.c \
e-config.c \
e-cursor.c \
e-datetime-format.c \
e-dialog-utils.c \
e-dialog-widgets.c \

View File

@ -1,68 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
* Srinivasa Ragavan <sragavan@novell.com>
*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include "e-cursor.h"
/**
* e_cursor_set:
* @widget: Any widget in a window, to which busy cursor has to be set
* cursor: The type of cursor to be set defined in e-cursor.h
*
* Sets the cursor specified, to the top level window of the given widget.
* It is not window aware, so if you popup a window, it will not have
* busy cursor set. That has to be handled seperately with a new call to this
* function.
*
* Return value:
**/
void e_cursor_set (GtkWidget *widget, ECursorType cursor)
{
GtkWidget *toplevel;
GdkCursor *window_cursor;
toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel) && gtk_widget_get_window (GTK_WIDGET (toplevel))) {
switch (cursor) {
case E_CURSOR_NORMAL :
window_cursor = gdk_cursor_new (GDK_LEFT_PTR);
break;
case E_CURSOR_BUSY :
window_cursor = gdk_cursor_new (GDK_WATCH);
break;
default :
window_cursor = gdk_cursor_new (GDK_LEFT_PTR);
}
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (toplevel)), window_cursor);
gdk_cursor_unref (window_cursor);
}
}

View File

@ -1,36 +0,0 @@
/*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
* Srinivasa Ragavan <sragavan@novell.com>
*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
#ifndef _E_CURSOR_H
#define _E_CURSOR_H
#include <gtk/gtk.h>
typedef enum {
E_CURSOR_NORMAL,
E_CURSOR_BUSY
} ECursorType;
void e_cursor_set (GtkWidget *widget, ECursorType cursor);
#endif /* !_E_CURSOR_H */

View File

@ -58,7 +58,6 @@
#include <camel/camel-string-utils.h>
#include <camel/camel-operation.h>
#include <misc/e-cursors.h>
#include <e-util/e-util.h>
#include <e-util/e-util-private.h>

View File

@ -63,8 +63,6 @@
#include "e-util/e-util-private.h"
#include "e-util/e-util.h"
#include "widgets/misc/e-cursors.h"
#include <fcntl.h>
#include <signal.h>
#include <string.h>
@ -574,7 +572,6 @@ main (gint argc, gchar **argv)
}
glade_init ();
e_cursors_init ();
e_icon_factory_init ();
e_passwords_init ();
@ -628,7 +625,6 @@ main (gint argc, gchar **argv)
gtk_accel_map_save (e_get_accels_filename ());
e_icon_factory_shutdown ();
e_cursors_shutdown ();
#ifdef G_OS_WIN32
link_shutdown ();
#endif

View File

@ -45,7 +45,6 @@ widgetsinclude_HEADERS = \
e-charset-combo-box.h \
e-colors.h \
e-combo-cell-editable.h \
e-cursors.h \
e-dateedit.h \
e-gui-utils.h \
e-hinted-entry.h \
@ -121,7 +120,6 @@ libemiscwidgets_la_SOURCES = \
e-charset-combo-box.c \
e-colors.c \
e-combo-cell-editable.c \
e-cursors.c \
e-dateedit.c \
e-gui-utils.c \
e-hinted-entry.c \
@ -227,8 +225,4 @@ EXTRA_DIST = \
e-pilot-settings.c \
ChangeLog.pre-1-4
dist-hook:
-mkdir $(distdir)/pixmaps
cp $(srcdir)/pixmaps/*.xpm $(distdir)/pixmaps
-include $(top_srcdir)/git.mk

View File

@ -1,159 +0,0 @@
/*
* e-cursors.c - cursor handling for gnumeric
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
* Miguel de Icaza (miguel@gnu.org)
*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
#include <config.h>
#include <stdio.h>
#include "e-colors.h"
#include "e-cursors.h"
#include "pixmaps/cursor_cross.xpm"
#include "pixmaps/cursor_zoom_in.xpm"
#include "pixmaps/cursor_zoom_out.xpm"
#include "pixmaps/cursor_hand_open.xpm"
#include "pixmaps/cursor_hand_closed.xpm"
#define GDK_INTERNAL_CURSOR -1
typedef struct {
GdkCursor *cursor;
gint hot_x, hot_y;
const gchar **xpm;
} CursorDef;
static CursorDef cursors [] = {
{ NULL, 17, 17, cursor_cross_xpm },
{ NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL },
{ NULL, GDK_INTERNAL_CURSOR, GDK_ARROW, NULL },
{ NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL },
{ NULL, 24, 24, cursor_zoom_in_xpm },
{ NULL, 24, 24, cursor_zoom_out_xpm },
{ NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL },
{ NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL },
{ NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL },
{ NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL },
{ NULL, GDK_INTERNAL_CURSOR, GDK_HAND2, NULL },
{ NULL, 10, 10, cursor_hand_open_xpm },
{ NULL, 10, 10, cursor_hand_closed_xpm },
{ NULL, GDK_INTERNAL_CURSOR, GDK_XTERM, NULL },
{ NULL, 0, 0, NULL }
};
static void
create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, const gchar **xpm)
{
gint height, width, colors;
gchar pixmap_buffer [(32 * 32)/8];
gchar mask_buffer [(32 * 32)/8];
gint x, y, pix, yofs;
gint transparent_color, black_color;
sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix);
g_return_if_fail (height == 32);
g_return_if_fail (width == 32);
g_return_if_fail (colors <= 3);
transparent_color = ' ';
black_color = '.';
yofs = colors + 1;
for (y = 0; y < 32; y++) {
for (x = 0; x < 32;) {
gchar value = 0, maskv = 0;
for (pix = 0; pix < 8; pix++, x++) {
if (xpm [y + yofs][x] != transparent_color) {
maskv |= 1 << pix;
/*
* Invert the colours here because it seems
* to workaround a bug the Matrox G100 Xserver?
* We reverse the foreground & background in the next
* routine to compensate.
*/
if (xpm [y + yofs][x] == black_color) {
value |= 1 << pix;
}
}
}
pixmap_buffer [(y * 4 + x/8)-1] = value;
mask_buffer [(y * 4 + x/8)-1] = maskv;
}
}
*bitmap = gdk_bitmap_create_from_data (NULL, pixmap_buffer, 32, 32);
*mask = gdk_bitmap_create_from_data (NULL, mask_buffer, 32, 32);
}
void
e_cursors_init (void)
{
gint i;
e_color_init ();
for (i = 0; cursors [i].hot_x; i++) {
if (cursors [i].hot_x < 0)
cursors [i].cursor = gdk_cursor_new (cursors [i].hot_y);
else {
GdkBitmap *bitmap = NULL, *mask = NULL;
create_bitmap_and_mask_from_xpm (&bitmap, &mask, cursors [i].xpm);
/* The foreground and background colours are reversed.
* See comment above for explanation.
*/
cursors [i].cursor =
gdk_cursor_new_from_pixmap (
bitmap, mask,
&e_black, &e_white,
cursors [i].hot_x,
cursors [i].hot_y);
g_object_unref (bitmap);
g_object_unref (mask);
}
}
g_return_if_fail (i == E_CURSOR_NUM_CURSORS);
}
void
e_cursors_shutdown (void)
{
gint i;
for (i = 0; cursors [i].hot_x; i++)
gdk_cursor_unref (cursors [i].cursor);
}
/* Returns a cursor given its type */
GdkCursor *
e_cursor_get (ECursorType type)
{
g_return_val_if_fail (type < E_CURSOR_NUM_CURSORS, NULL);
return cursors [type].cursor;
}

View File

@ -1,68 +0,0 @@
/*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
* Miguel de Icaza (miguel@gnu.org)
*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
*/
#ifndef GNOME_APP_LIB_CURSORS_H
#define GNOME_APP_LIB_CURSORS_H
#include <gdk/gdk.h>
G_BEGIN_DECLS
typedef enum {
E_CURSOR_FAT_CROSS,
E_CURSOR_THIN_CROSS,
E_CURSOR_ARROW,
E_CURSOR_MOVE,
E_CURSOR_ZOOM_IN,
E_CURSOR_ZOOM_OUT,
E_CURSOR_SIZE_X,
E_CURSOR_SIZE_Y,
E_CURSOR_SIZE_TL,
E_CURSOR_SIZE_TR,
E_CURSOR_PRESS,
E_CURSOR_HAND_OPEN,
E_CURSOR_HAND_CLOSED,
E_CURSOR_XTERM,
E_CURSOR_NUM_CURSORS
} ECursorType;
void e_cursors_init (void);
void e_cursors_shutdown (void);
#define e_cursor_set(win, c) \
G_STMT_START { \
if (win) \
gdk_window_set_cursor (win, e_cursor_get (c)); \
} G_STMT_END
#define e_cursor_set_widget(w, c) \
G_STMT_START { \
if (GTK_WIDGET (w)->window) \
gdk_window_set_cursor (GTK_WIDGET (w)->window, e_cursor_get (c)); \
} G_STMT_END
GdkCursor *e_cursor_get (ECursorType type);
G_END_DECLS
#endif /* GNOME_APP_LIB_CURSORS_H */

View File

@ -1,11 +0,0 @@
pixmaps = \
cursor_cross.xpm \
cursor_hand_closed.xpm \
cursor_hand_open.xpm \
cursor_zoom_in.xpm \
cursor_zoom_out.xpm
EXTRA_DIST = \
$(pixmaps)
-include $(top_srcdir)/git.mk

View File

@ -1,38 +0,0 @@
/* XPM */
static const gchar *cursor_cross_xpm[] = {
"32 32 3 1",
" c None",
". c #000000",
"+ c #FFFFFF",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ....... ",
" .+++++.. ",
" .+++++.. ",
" .+++++.. ",
" .+++++.. ",
" ......+++++...... ",
" .+++++++++++++++.. ",
" .+++++++++++++++.. ",
" .+++++++++++++++.. ",
" .+++++++++++++++.. ",
" .+++++++++++++++.. ",
" ......+++++....... ",
" .....+++++....... ",
" .+++++.. ",
" .+++++.. ",
" .+++++.. ",
" ........ ",
" ....... ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@ -1,38 +0,0 @@
/* XPM */
static const gchar *cursor_hand_closed_xpm[] = {
"32 32 3 1",
" c None",
". c #000000",
"+ c #FFFFFF",
" ",
" ",
" ",
" ",
" ",
" .. ",
" ..++... ",
" .+++++++.. ",
" .+++++++++. ",
" ...+++++++++. ",
" .++.+++++++++. ",
" .++++++++++++. ",
" .+++++++++++. ",
" .++++++++++. ",
" .+++++++++. ",
" .+++++++. ",
" .++++++. ",
" .++++++. ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@ -1,38 +0,0 @@
/* XPM */
static const gchar *cursor_hand_open_xpm[] = {
"32 32 3 1",
" c None",
". c #000000",
"+ c #FFFFFF",
" ",
" ",
" .. ",
" .. .++... ",
" .++..++.++. ",
" .++..++.++. . ",
" .++.++.++..+. ",
" .++.++.++.++. ",
" .. .+++++++.++. ",
" .++..++++++++++. ",
" .+++.+++++++++. ",
" .++++++++++++. ",
" .+++++++++++. ",
" .++++++++++. ",
" .+++++++++. ",
" .+++++++. ",
" .++++++. ",
" .++++++. ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@ -1,37 +0,0 @@
/* XPM */
static const gchar *cursor_zoom_in_xpm[] = {
"32 32 2 1",
" c None",
". c #000000",
" ",
" ",
" ",
" ",
" ",
" ",
" ...... ",
" .. .. ",
" .. .. ",
" . . ",
" . ... . ",
" . ... . ",
" . ....... . ",
" . ....... . ",
" . ... . ",
" . ... .. ",
" .. . . ",
" .. . . . ",
" ........ . . ",
" ..... . . . ",
" . . . ",
" . . . ",
" . . . ",
" . . . ",
" . . ",
" . . ",
" .. ",
" ",
" ",
" ",
" ",
" "};

View File

@ -1,37 +0,0 @@
/* XPM */
static const gchar *cursor_zoom_out_xpm[] = {
"32 32 2 1",
" c None",
". c #000000",
" ",
" ",
" ",
" ",
" ",
" ",
" ...... ",
" .. .. ",
" .. .. ",
" . . ",
" . . ",
" . . ",
" . ....... . ",
" . ....... . ",
" . . ",
" . .. ",
" .. . . ",
" .. . . . ",
" ........ . . ",
" ..... . . . ",
" . . . ",
" . . . ",
" . . . ",
" . . . ",
" . . ",
" . . ",
" .. ",
" ",
" ",
" ",
" ",
" "};

View File

@ -38,7 +38,6 @@
#include "e-util/e-util.h"
#include "e-util/e-xml-utils.h"
#include "misc/e-canvas.h"
#include "misc/e-cursors.h"
#include "misc/e-gui-utils.h"
#include "misc/e-popup-menu.h"
@ -121,6 +120,11 @@ ethi_dispose (GObject *object) {
scroll_off (ethi);
if (ethi->resize_cursor) {
gdk_cursor_unref (ethi->resize_cursor);
ethi->resize_cursor = NULL;
}
if (ethi->dnd_code) {
g_free (ethi->dnd_code);
ethi->dnd_code = NULL;
@ -1081,10 +1085,9 @@ set_cursor (ETableHeaderItem *ethi, gint pos)
}
if (resizable)
e_cursor_set (canvas->window, E_CURSOR_SIZE_X);
gdk_window_set_cursor (canvas->window, ethi->resize_cursor);
else
gdk_window_set_cursor (canvas->window, NULL);
/* e_cursor_set (canvas->window, E_CURSOR_ARROW);*/
}
static void
@ -1695,7 +1698,6 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_LEAVE_NOTIFY:
gdk_window_set_cursor (GTK_WIDGET (canvas)->window, NULL);
/* e_cursor_set (GTK_WIDGET (canvas)->window, E_CURSOR_ARROW);*/
break;
case GDK_MOTION_NOTIFY:
@ -1711,7 +1713,7 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
gnome_canvas_item_grab (item,
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
e_cursor_get (E_CURSOR_SIZE_X),
ethi->resize_cursor,
e->button.time);
}
@ -1952,6 +1954,8 @@ ethi_init (ETableHeaderItem *ethi)
{
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ethi);
ethi->resize_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
ethi->resize_col = -1;
item->x1 = 0;

View File

@ -44,6 +44,7 @@ typedef struct {
ETableHeader *eth;
GdkCursor *change_cursor;
GdkCursor *resize_cursor;
short height, width;
PangoFontDescription *font_desc;