aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-05-04 14:16:33 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-05-04 14:16:33 +0800
commit5801d079852bd2e877d9511e4c3ea8083066c58c (patch)
treeafafffc9c1c2fac6b5e18e737b9f762bb76c16c3
parentf8bfbef0a705629ae2aefa71dc06b7d64fbd5274 (diff)
downloadgsoc2013-evolution-5801d079852bd2e877d9511e4c3ea8083066c58c.tar
gsoc2013-evolution-5801d079852bd2e877d9511e4c3ea8083066c58c.tar.gz
gsoc2013-evolution-5801d079852bd2e877d9511e4c3ea8083066c58c.tar.bz2
gsoc2013-evolution-5801d079852bd2e877d9511e4c3ea8083066c58c.tar.lz
gsoc2013-evolution-5801d079852bd2e877d9511e4c3ea8083066c58c.tar.xz
gsoc2013-evolution-5801d079852bd2e877d9511e4c3ea8083066c58c.tar.zst
gsoc2013-evolution-5801d079852bd2e877d9511e4c3ea8083066c58c.zip
Fixed EShortcutBar API: the icon callback function now gets a `const
char *' url (instead of just a `char *') and a closure. svn path=/trunk/; revision=2790
-rw-r--r--shell/ChangeLog7
-rw-r--r--shell/e-shortcut.c4
-rw-r--r--widgets/shortcut-bar/ChangeLog15
-rw-r--r--widgets/shortcut-bar/e-shortcut-bar.c10
-rw-r--r--widgets/shortcut-bar/e-shortcut-bar.h11
-rw-r--r--widgets/shortcut-bar/test-shortcut-bar.c12
6 files changed, 47 insertions, 12 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 2d392d1d88..53459c828c 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,10 @@
+2000-05-04 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-shortcut.c (shell_icon_cb): Type of @url changed from `gchar
+ *' to `const gchar *'; new arg @data.
+ (e_shortcut_bar_view_new): Pass NULL as the closure value for
+ `e_shortcut_bar_set_icon_callback()'.
+
2000-05-02 Ettore Perazzoli <ettore@helixcode.com>
* e-folder-mail.c: Removed.
diff --git a/shell/e-shortcut.c b/shell/e-shortcut.c
index d066394049..ed09abe932 100644
--- a/shell/e-shortcut.c
+++ b/shell/e-shortcut.c
@@ -360,7 +360,7 @@ static struct {
#define NSHELL_ICONS (sizeof (shell_icons) / sizeof (shell_icons[0]))
static GdkPixbuf *
-shell_icon_cb (EShortcutBar *shortcut_bar, gchar *url)
+shell_icon_cb (EShortcutBar *shortcut_bar, const gchar *url, gpointer data)
{
int i;
@@ -402,7 +402,7 @@ e_shortcut_bar_view_new (EShortcutBarModel *bm)
shortcut_bar = e_shortcut_bar_new ();
e_shortcut_bar_set_icon_callback (E_SHORTCUT_BAR (shortcut_bar),
- shell_icon_cb);
+ shell_icon_cb, NULL);
gtk_widget_pop_visual ();
gtk_widget_pop_colormap ();
diff --git a/widgets/shortcut-bar/ChangeLog b/widgets/shortcut-bar/ChangeLog
index cbe187f9e4..d8b7d82022 100644
--- a/widgets/shortcut-bar/ChangeLog
+++ b/widgets/shortcut-bar/ChangeLog
@@ -1,3 +1,18 @@
+2000-05-04 Ettore Perazzoli <ettore@helixcode.com>
+
+ * test-shortcut-bar.c (icon_callback): Adapted to the new
+ `EShortcutBarIconCallback' typedef: get a @data parameter and get
+ a const-safe @url.
+
+ * e-shortcut-bar.c (e_shortcut_bar_set_icon_callback): New param
+ @data. Set `icon_callback_data' to it.
+ (e_shortcut_bar_get_image_from_url): Pass the callback data to the
+ callback.
+
+ * e-shortcut-bar.h: Changed `EShortcutBarIconCallback' to get a
+ const-safe @url parameter and a new @data parameter as a closure.
+ New member `data' in `EShortcutBar'.
+
2000-05-02 Matt Loper <matt@helixcode.com>
* Makefile.am: set G_LOG_DOMAIN.
diff --git a/widgets/shortcut-bar/e-shortcut-bar.c b/widgets/shortcut-bar/e-shortcut-bar.c
index 5195f2d856..e07e840f53 100644
--- a/widgets/shortcut-bar/e-shortcut-bar.c
+++ b/widgets/shortcut-bar/e-shortcut-bar.c
@@ -535,10 +535,12 @@ e_shortcut_bar_stop_editing (GtkWidget *button,
/* Sets the callback which is called to return the icon to use for a particular
URL. */
void
-e_shortcut_bar_set_icon_callback (EShortcutBar *shortcut_bar,
- EShortcutBarIconCallback cb)
+e_shortcut_bar_set_icon_callback (EShortcutBar *shortcut_bar,
+ EShortcutBarIconCallback cb,
+ gpointer data)
{
shortcut_bar->icon_callback = cb;
+ shortcut_bar->icon_callback_data = data;
}
@@ -549,7 +551,9 @@ e_shortcut_bar_get_image_from_url (EShortcutBar *shortcut_bar,
GdkPixbuf *icon = NULL;
if (shortcut_bar->icon_callback)
- icon = (*shortcut_bar->icon_callback) (shortcut_bar, item_url);
+ icon = (*shortcut_bar->icon_callback) (shortcut_bar,
+ item_url,
+ shortcut_bar->icon_callback_data);
if (!icon) {
if (!e_shortcut_bar_default_icon_loaded) {
diff --git a/widgets/shortcut-bar/e-shortcut-bar.h b/widgets/shortcut-bar/e-shortcut-bar.h
index 0164bf1c94..682967b12a 100644
--- a/widgets/shortcut-bar/e-shortcut-bar.h
+++ b/widgets/shortcut-bar/e-shortcut-bar.h
@@ -42,7 +42,8 @@ typedef struct _EShortcutBarClass EShortcutBarClass;
typedef GdkPixbuf* (*EShortcutBarIconCallback) (EShortcutBar *shortcut_bar,
- gchar *url);
+ const gchar *url,
+ gpointer data);
/* This contains information on one group. */
typedef struct _EShortcutBarGroup EShortcutBarGroup;
@@ -72,6 +73,9 @@ struct _EShortcutBar
for a given URL. */
EShortcutBarIconCallback icon_callback;
+ /* Closure for the callback. */
+ gpointer icon_callback_data;
+
gchar *dragged_url;
gchar *dragged_name;
};
@@ -117,8 +121,9 @@ void e_shortcut_bar_remove_item (EShortcutBar *shortcut_bar,
/* Sets the callback which is called to return the icon to use for a particular
URL. This callback must be set before any items are added. If the callback
returns NULL the default icon is used. */
-void e_shortcut_bar_set_icon_callback (EShortcutBar *shortcut_bar,
- EShortcutBarIconCallback cb);
+void e_shortcut_bar_set_icon_callback (EShortcutBar *shortcut_bar,
+ EShortcutBarIconCallback cb,
+ gpointer data);
#ifdef __cplusplus
}
diff --git a/widgets/shortcut-bar/test-shortcut-bar.c b/widgets/shortcut-bar/test-shortcut-bar.c
index 6a62311638..abdccddeb1 100644
--- a/widgets/shortcut-bar/test-shortcut-bar.c
+++ b/widgets/shortcut-bar/test-shortcut-bar.c
@@ -42,8 +42,10 @@ GdkPixbuf *icon_pixbufs[NUM_SHORTCUT_TYPES];
GtkWidget *main_label;
-static GdkPixbuf* icon_callback (EShortcutBar *shortcut_bar,
- gchar *url);
+static GdkPixbuf *icon_callback (EShortcutBar *shortcut_bar,
+ const gchar *url,
+ gpointer data);
+
static void on_main_label_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
gpointer data);
@@ -110,7 +112,8 @@ main (int argc, char *argv[])
gtk_paned_pack1 (GTK_PANED (hpaned), shortcut_bar, FALSE, TRUE);
gtk_widget_show (shortcut_bar);
e_shortcut_bar_set_icon_callback (E_SHORTCUT_BAR (shortcut_bar),
- icon_callback);
+ icon_callback,
+ NULL);
#if 0
gtk_container_set_border_width (GTK_CONTAINER (shortcut_bar), 4);
@@ -179,7 +182,8 @@ main (int argc, char *argv[])
static GdkPixbuf*
icon_callback (EShortcutBar *shortcut_bar,
- gchar *url)
+ const gchar *url,
+ gpointer data)
{
gint i;