diff options
author | JP Rosevear <jpr@novell.com> | 2004-11-26 22:57:49 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-11-26 22:57:49 +0800 |
commit | 43cbcd8b63c9f876d78daf14883134080b4cc937 (patch) | |
tree | 5f51230c0c8519f09ddd8622b38ef6434fe1268d /e-util | |
parent | e77cfd7e4008635870949d708133a848294dd6fd (diff) | |
download | gsoc2013-evolution-43cbcd8b63c9f876d78daf14883134080b4cc937.tar.gz gsoc2013-evolution-43cbcd8b63c9f876d78daf14883134080b4cc937.tar.zst gsoc2013-evolution-43cbcd8b63c9f876d78daf14883134080b4cc937.zip |
get the image directly from the icon factory
2004-11-26 JP Rosevear <jpr@novell.com>
* e-gui-utils.c (e_create_image_widget): get the image directly
from the icon factory
* e-config.c: insert debug defines so we can
turn spew on and off
* e-event.c: insert debug defines so we can turn spew on and off
* e-menu.c: insert debug defines so we can turn spew on and off
* e-plugin.c: insert debug defines and set to off for now
* e-popup.c: insert debug defines so we can turn spew on and off
(e_popup_create_menu): get the image directly from the icon
factory
svn path=/trunk/; revision=27997
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/ChangeLog | 18 | ||||
-rw-r--r-- | e-util/e-config.c | 56 | ||||
-rw-r--r-- | e-util/e-event.c | 12 | ||||
-rw-r--r-- | e-util/e-gui-utils.c | 5 | ||||
-rw-r--r-- | e-util/e-menu.c | 47 | ||||
-rw-r--r-- | e-util/e-plugin.c | 16 | ||||
-rw-r--r-- | e-util/e-popup.c | 25 |
7 files changed, 99 insertions, 80 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index f10860327b..d910e8d838 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,5 +1,23 @@ 2004-11-26 JP Rosevear <jpr@novell.com> + * e-gui-utils.c (e_create_image_widget): get the image directly + from the icon factory + + * e-config.c: insert debug defines so we can + turn spew on and off + + * e-event.c: insert debug defines so we can turn spew on and off + + * e-menu.c: insert debug defines so we can turn spew on and off + + * e-plugin.c: insert debug defines and set to off for now + + * e-popup.c: insert debug defines so we can turn spew on and off + (e_popup_create_menu): get the image directly from the icon + factory + +2004-11-26 JP Rosevear <jpr@novell.com> + * e-icon-factory.h: add proto * e-icon-factory.c (e_icon_factory_init): cast to kill warning diff --git a/e-util/e-config.c b/e-util/e-config.c index 03f853cd13..99cb18382c 100644 --- a/e-util/e-config.c +++ b/e-util/e-config.c @@ -47,6 +47,8 @@ #include <libgnome/gnome-i18n.h> +#define d(x) + struct _EConfigFactory { struct _EConfigFactory *next, *prev; @@ -118,7 +120,7 @@ ep_finalise(GObject *o) struct _widget_node *wn; struct _check_node *cn; - printf("finalising EConfig %p\n", o); + d(printf("finalising EConfig %p\n", o)); g_free(emp->id); @@ -162,7 +164,7 @@ ec_set_target(EConfig *emp, EConfigTarget *target) static void ep_class_init(GObjectClass *klass) { - printf("EConfig class init %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type)); + d(printf("EConfig class init %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type))); klass->finalize = ep_finalise; ((EConfigClass *)klass)->set_target = ec_set_target; @@ -327,7 +329,7 @@ ec_druid_check_current(EConfig *ec) static void ec_druid_cancel(GnomeDruid *druid, struct _widget_node *wn) { - printf("finishing druid, calling abort\n"); + d(printf("finishing druid, calling abort\n")); e_config_abort(wn->config); if (wn->config->window) @@ -337,7 +339,7 @@ ec_druid_cancel(GnomeDruid *druid, struct _widget_node *wn) static void ec_druid_finish(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) { - printf("finishing druid, calling commit\n"); + d(printf("finishing druid, calling commit\n")); e_config_commit(wn->config); /* TODO: allow the commit to fail? Do we care? */ @@ -348,7 +350,7 @@ ec_druid_finish(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn static void ec_druid_prepare(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) { - printf("prepare page '%s'\n", wn->item->path); + d(printf("prepare page '%s'\n", wn->item->path)); wn->config->priv->druid_page = wn; ec_druid_check_current(wn->config); } @@ -358,7 +360,7 @@ ec_druid_prev(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) { EConfig *ec = wn->config; - printf("prev page from '%s'\n", wn->item->path); + d(printf("prev page from '%s'\n", wn->item->path)); if (wn->prev) { for (wn = wn->prev;wn->prev;wn=wn->prev) { if (!wn->empty @@ -370,7 +372,7 @@ ec_druid_prev(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) } if (wn->prev) { - printf(" is %s\n",wn->item->path); + d(printf(" is %s\n",wn->item->path)); gnome_druid_set_page((GnomeDruid *)ec->widget, (GnomeDruidPage *)wn->frame); ec->priv->druid_page = wn; } else { @@ -386,7 +388,7 @@ ec_druid_next(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) { EConfig *ec = wn->config; - printf("next page from '%s'\n", wn->item->path); + d(printf("next page from '%s'\n", wn->item->path)); if (wn->next) { for (wn = wn->next;wn->next;wn=wn->next) { if (!wn->empty @@ -398,7 +400,7 @@ ec_druid_next(GnomeDruidPage *page, GnomeDruid *druid, struct _widget_node *wn) } if (wn->next) { - printf(" is %s\n",wn->item->path); + d(printf(" is %s\n",wn->item->path)); gnome_druid_set_page((GnomeDruid *)ec->widget, (GnomeDruidPage *)wn->frame); ec->priv->druid_page = wn; } else { @@ -417,7 +419,7 @@ ec_rebuild(EConfig *emp) GtkWidget *book = NULL, *page = NULL, *section = NULL, *root = NULL, *druid = NULL; int pageno = 0, sectionno = 0, itemno = 0; - printf("target changed, rebuilding:\n"); + d(printf("target changed, rebuilding:\n")); /* TODO: This code is pretty complex, and will probably just * become more complex with time. It could possibly be split @@ -428,7 +430,7 @@ ec_rebuild(EConfig *emp) struct _EConfigItem *item = wn->item; GtkWidget *w; - printf(" '%s'\n", item->path); + d(printf(" '%s'\n", item->path)); /* If the last section doesn't contain anything, hide it */ if (sectionnode != NULL @@ -442,7 +444,7 @@ ec_rebuild(EConfig *emp) sectionno--; } else gtk_widget_show(sectionnode->frame); - printf("%s section '%s' [sections=%d]\n", sectionnode->empty?"hiding":"showing", sectionnode->item->path, sectionno); + d(printf("%s section '%s' [sections=%d]\n", sectionnode->empty?"hiding":"showing", sectionnode->item->path, sectionno)); } /* If the last page doesn't contain anything, hide it */ @@ -455,7 +457,7 @@ ec_rebuild(EConfig *emp) pageno--; } else gtk_widget_show(pagenode->frame); - printf("%s page '%s' [section=%d]\n", pagenode->empty?"hiding":"showing", pagenode->item->path, pageno); + d(printf("%s page '%s' [section=%d]\n", pagenode->empty?"hiding":"showing", pagenode->item->path, pageno)); } /* Now process the item */ @@ -595,10 +597,10 @@ ec_rebuild(EConfig *emp) } else page = wn->widget; - printf("page %d:%s widget %p\n", pageno, item->path, w); + d(printf("page %d:%s widget %p\n", pageno, item->path, w)); if (wn->widget && wn->widget != page) { - printf("destroy old widget for page '%s'\n", item->path); + d(printf("destroy old widget for page '%s'\n", item->path)); gtk_widget_destroy(wn->widget); } @@ -674,7 +676,7 @@ ec_rebuild(EConfig *emp) } nopage: if (wn->widget && wn->widget != section) { - printf("destroy old widget for section '%s'\n", item->path); + d(printf("destroy old widget for section '%s'\n", item->path)); gtk_widget_destroy(wn->widget); } @@ -696,10 +698,10 @@ ec_rebuild(EConfig *emp) else if (item->factory) w = item->factory(emp, item, section, wn->widget, wn->context->data); - printf("item %d:%s widget %p\n", itemno, item->path, w); + d(printf("item %d:%s widget %p\n", itemno, item->path, w)); if (wn->widget && wn->widget != w) { - printf("destroy old widget for item '%s'\n", item->path); + d(printf("destroy old widget for item '%s'\n", item->path)); gtk_widget_destroy(wn->widget); } @@ -717,7 +719,7 @@ ec_rebuild(EConfig *emp) sectionno--; } else gtk_widget_show(sectionnode->frame); - printf("%s section '%s' [sections=%d]\n", sectionnode->empty?"hiding":"showing", sectionnode->item->path, sectionno); + d(printf("%s section '%s' [sections=%d]\n", sectionnode->empty?"hiding":"showing", sectionnode->item->path, sectionno)); } /* If the last page doesn't contain anything, hide it */ @@ -727,7 +729,7 @@ ec_rebuild(EConfig *emp) pageno--; } else gtk_widget_show(pagenode->frame); - printf("%s page '%s' [section=%d]\n", pagenode->empty?"hiding":"showing", pagenode->item->path, pageno); + d(printf("%s page '%s' [section=%d]\n", pagenode->empty?"hiding":"showing", pagenode->item->path, pageno)); } if (book) { @@ -1237,7 +1239,7 @@ ech_config_factory(EConfig *emp, void *data) { struct _EConfigHookGroup *group = data; - printf("config factory called %s\n", group->id?group->id:"all menus"); + d(printf("config factory called %s\n", group->id?group->id:"all menus")); if (emp->target->type != group->target_type) return; @@ -1288,7 +1290,7 @@ emph_construct_item(EPluginHook *eph, EConfigHookGroup *menu, xmlNodePtr root, E { struct _EConfigItem *item; - printf(" loading config item\n"); + d(printf(" loading config item\n")); item = g_malloc0(sizeof(*item)); if ((item->type = e_plugin_hook_id(root, ech_item_types, "type")) == -1) goto error; @@ -1303,11 +1305,11 @@ emph_construct_item(EPluginHook *eph, EConfigHookGroup *menu, xmlNodePtr root, E if (item->user_data) item->factory = ech_config_widget_factory; - printf(" path=%s label=%s factory=%s\n", item->path, item->label, (char *)item->user_data); + d(printf(" path=%s label=%s factory=%s\n", item->path, item->label, (char *)item->user_data)); return item; error: - printf("error!\n"); + d(printf("error!\n")); emph_free_item(item); return NULL; } @@ -1321,7 +1323,7 @@ emph_construct_menu(EPluginHook *eph, xmlNodePtr root) EConfigHookClass *klass = (EConfigHookClass *)G_OBJECT_GET_CLASS(eph); char *tmp; - printf(" loading menu\n"); + d(printf(" loading menu\n")); menu = g_malloc0(sizeof(*menu)); tmp = xmlGetProp(root, "target"); @@ -1362,7 +1364,7 @@ emph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) xmlNodePtr node; EConfigClass *klass; - printf("loading config hook\n"); + d(printf("loading config hook\n")); if (((EPluginHookClass *)emph_parent_class)->construct(eph, ep, root) == -1) return -1; @@ -1408,7 +1410,7 @@ emph_class_init(EPluginHookClass *klass) /* this is actually an abstract implementation but list it anyway */ klass->id = "org.gnome.evolution.config:1.0"; - printf("EConfigHook: init class %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type)); + d(printf("EConfigHook: init class %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type))); ((EConfigHookClass *)klass)->target_map = g_hash_table_new(g_str_hash, g_str_equal); ((EConfigHookClass *)klass)->config_class = g_type_class_ref(e_config_get_type()); diff --git a/e-util/e-event.c b/e-util/e-event.c index 44f9be5c85..156d0ae839 100644 --- a/e-util/e-event.c +++ b/e-util/e-event.c @@ -44,6 +44,8 @@ #include <libgnome/gnome-i18n.h> +#define d(x) + struct _EEventFactory { struct _EEventFactory *next, *prev; @@ -121,7 +123,7 @@ ep_target_free(EEvent *ep, EEventTarget *t) static void ep_class_init(GObjectClass *klass) { - printf("EEvent class init %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type)); + d(printf("EEvent class init %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type))); klass->finalize = ep_finalise; ((EEventClass *)klass)->target_free = ep_target_free; @@ -255,7 +257,7 @@ e_event_emit(EEvent *emp, const char *id, EEventTarget *target) struct _EEventPrivate *p = emp->priv; GSList *events; - printf("emit event %s\n", id); + d(printf("emit event %s\n", id)); g_assert(emp->target == NULL); @@ -284,7 +286,7 @@ e_event_emit(EEvent *emp, const char *id, EEventTarget *target) struct _event_info *info = events->data; EEventItem *event = info->item; - printf("event '%s' mask %08x target %08x\n", event->id, event->enable, target->mask); + d(printf("event '%s' mask %08x target %08x\n", event->id, event->enable, target->mask)); if (event->enable & target->mask) continue; @@ -466,7 +468,7 @@ emph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) g_return_val_if_fail(((EEventHookClass *)G_OBJECT_GET_CLASS(eph))->event != NULL, -1); - printf("loading event hook\n"); + d(printf("loading event hook\n")); if (((EPluginHookClass *)emph_parent_class)->construct(eph, ep, root) == -1) return -1; @@ -510,7 +512,7 @@ emph_class_init(EPluginHookClass *klass) /* this is actually an abstract implementation but list it anyway */ klass->id = "org.gnome.evolution.event:1.0"; - printf("EEventHook: init class %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type)); + d(printf("EEventHook: init class %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type))); ((EEventHookClass *)klass)->target_map = g_hash_table_new(g_str_hash, g_str_equal); } diff --git a/e-util/e-gui-utils.c b/e-util/e-gui-utils.c index cb9f57e5c1..3e8849fe93 100644 --- a/e-util/e-gui-utils.c +++ b/e-util/e-gui-utils.c @@ -40,10 +40,7 @@ GtkWidget *e_create_image_widget(gchar *name, GtkWidget *w; if (string1) { - pixbuf = e_icon_factory_get_icon (string1, E_ICON_SIZE_DIALOG); - - w = gtk_image_new_from_pixbuf (pixbuf); - g_object_unref (pixbuf); + w = e_icon_factory_get_image (string1, E_ICON_SIZE_DIALOG); gtk_misc_set_alignment (GTK_MISC (w), 0.5, 0.5); diff --git a/e-util/e-menu.c b/e-util/e-menu.c index 7d4809544f..ca3d98a07a 100644 --- a/e-util/e-menu.c +++ b/e-util/e-menu.c @@ -36,6 +36,8 @@ #include <libgnome/gnome-i18n.h> #include <bonobo/bonobo-ui-util.h> +#define d(x) + struct _EMenuFactory { struct _EMenuFactory *next, *prev; @@ -129,9 +131,8 @@ em_target_free(EMenu *ep, EMenuTarget *t) static void em_class_init(GObjectClass *klass) { - printf("EMenu class init %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type)); + d(printf("EMenu class init %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type))); - printf("e menu class init\n"); klass->finalize = em_finalise; ((EMenuClass *)klass)->target_free = em_target_free; } @@ -140,7 +141,7 @@ static void em_base_init(GObjectClass *klass) { /* each class instance must have its own list, it isn't inherited */ - printf("%p: list init\n", klass); + d(printf("%p: list init\n", klass)); e_dlist_init(&((EMenuClass *)klass)->factories); } @@ -186,24 +187,24 @@ EMenu *e_menu_construct(EMenu *em, const char *menuid) struct _EMenuFactory *f; EMenuClass *klass; - printf("constructing menu '%s'\n", menuid); + d(printf("constructing menu '%s'\n", menuid)); klass = (EMenuClass *)G_OBJECT_GET_CLASS(em); - printf(" class is %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type)); + d(printf(" class is %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type))); em->menuid = g_strdup(menuid); /* setup the menu itself based on factories */ f = (struct _EMenuFactory *)klass->factories.head; if (f->next == NULL) { - printf("%p no factories registered on menu\n", klass); + d(printf("%p no factories registered on menu\n", klass)); } while (f->next) { if (f->menuid == NULL || !strcmp(f->menuid, em->menuid)) { - printf(" calling factory\n"); + d(printf(" calling factory\n")); f->factory(em, f->factory_data); } f = f->next; @@ -381,7 +382,7 @@ void e_menu_activate(EMenu *em, struct _BonoboUIComponent *uic, int act) EMenuItem *item = inode->item; BonoboUIVerb *verb; - printf("adding menu verb '%s'\n", item->verb); + d(printf("adding menu verb '%s'\n", item->verb)); switch (item->type & E_MENU_TYPE_MASK) { case E_MENU_ITEM: @@ -457,7 +458,7 @@ void e_menu_update_target(EMenu *em, void *tp) EMenuItem *item = l->data; int state; - printf("checking item '%s' mask %08x against target %08x\n", item->verb, item->enable, mask); + d(printf("checking item '%s' mask %08x against target %08x\n", item->verb, item->enable, mask)); state = (item->enable & mask) == 0; bonobo_ui_component_set_prop(em->uic, item->path, "sensitive", state?"1":"0", NULL); @@ -489,7 +490,7 @@ e_menu_class_add_factory(EMenuClass *klass, const char *menuid, EMenuFactoryFunc { struct _EMenuFactory *f = g_malloc0(sizeof(*f)); - printf("%p adding factory '%s' to class '%s'\n", klass, menuid?menuid:"<all menus>", g_type_name(((GObjectClass *)klass)->g_type_class.g_type)); + d(printf("%p adding factory '%s' to class '%s'\n", klass, menuid?menuid:"<all menus>", g_type_name(((GObjectClass *)klass)->g_type_class.g_type))); f->menuid = g_strdup(menuid); f->factory = func; @@ -502,7 +503,7 @@ e_menu_class_add_factory(EMenuClass *klass, const char *menuid, EMenuFactoryFunc j = (struct _EMenuFactory *)klass->factories.head; if (j->next == NULL) { - printf("%p no factories registered on menu???\n", klass); + d(printf("%p no factories registered on menu???\n", klass)); } } @@ -623,7 +624,7 @@ emph_menu_activate(EMenu *em, EMenuItem *item, void *data) { EMenuHook *hook = data; - printf("invoking plugin hook '%s' %p\n", (char *)item->user_data, em->target); + d(printf("invoking plugin hook '%s' %p\n", (char *)item->user_data, em->target)); e_plugin_invoke(hook->hook.plugin, item->user_data, em->target); } @@ -634,7 +635,7 @@ emph_menu_toggle_activate(EMenu *em, EMenuItem *item, int state, void *data) EMenuHook *hook = data; /* FIXME: where does the toggle state go? */ - printf("invoking plugin hook '%s' %p\n", (char *)item->user_data, em->target); + d(printf("invoking plugin hook '%s' %p\n", (char *)item->user_data, em->target)); e_plugin_invoke(hook->hook.plugin, item->user_data, em->target); } @@ -644,7 +645,7 @@ emph_menu_factory(EMenu *emp, void *data) { struct _EMenuHookMenu *menu = data; - printf("menu factory, adding %d items\n", g_slist_length(menu->items)); + d(printf("menu factory, adding %d items\n", g_slist_length(menu->items))); if (menu->items) e_menu_add_items(emp, menu->items, menu->uis, menu->pixmaps, NULL, menu->hook); @@ -695,7 +696,7 @@ emph_construct_item(EPluginHook *eph, EMenuHookMenu *menu, xmlNodePtr root, EMen { struct _EMenuItem *item; - printf(" loading menu item\n"); + d(printf(" loading menu item\n")); item = g_malloc0(sizeof(*item)); item->type = e_plugin_hook_id(root, emph_item_types, "type"); item->path = e_plugin_xml_prop(root, "path"); @@ -711,12 +712,12 @@ emph_construct_item(EPluginHook *eph, EMenuHookMenu *menu, xmlNodePtr root, EMen if (item->type == -1 || item->user_data == NULL) goto error; - printf(" path=%s\n", item->path); - printf(" verb=%s\n", item->verb); + d(printf(" path=%s\n", item->path)); + d(printf(" verb=%s\n", item->verb)); return item; error: - printf("error!\n"); + d(printf("error!\n")); emph_free_item(item); return NULL; } @@ -726,7 +727,7 @@ emph_construct_pixmap(EPluginHook *eph, EMenuHookMenu *menu, xmlNodePtr root) { struct _EMenuPixmap *pixmap; - printf(" loading menu pixmap\n"); + d(printf(" loading menu pixmap\n")); pixmap = g_malloc0(sizeof(*pixmap)); pixmap->command = e_plugin_xml_prop(root, "command"); pixmap->name = e_plugin_xml_prop(root, "pixmap"); @@ -737,7 +738,7 @@ emph_construct_pixmap(EPluginHook *eph, EMenuHookMenu *menu, xmlNodePtr root) return pixmap; error: - printf("error!\n"); + d(printf("error!\n")); emph_free_pixmap(pixmap); return NULL; } @@ -751,7 +752,7 @@ emph_construct_menu(EPluginHook *eph, xmlNodePtr root) EMenuHookClass *klass = (EMenuHookClass *)G_OBJECT_GET_CLASS(eph); char *tmp; - printf(" loading menu\n"); + d(printf(" loading menu\n")); menu = g_malloc0(sizeof(*menu)); menu->hook = (EMenuHook *)eph; @@ -795,7 +796,7 @@ emph_construct_menu(EPluginHook *eph, xmlNodePtr root) return menu; error: - printf("error loading menu hook\n"); + d(printf("error loading menu hook\n")); emph_free_menu(menu); return NULL; } @@ -806,7 +807,7 @@ emph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) xmlNodePtr node; EMenuClass *klass; - printf("loading menu hook\n"); + d(printf("loading menu hook\n")); if (((EPluginHookClass *)emph_parent_class)->construct(eph, ep, root) == -1) return -1; diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index 6167b1238f..b5ef769556 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -10,9 +10,9 @@ #include "e-msgport.h" /* plugin debug */ -#define pd(x) x +#define pd(x) /* plugin hook debug */ -#define phd(x) x +#define phd(x) /* <camel-plugin @@ -117,7 +117,7 @@ ep_construct(EPlugin *ep, xmlNodePtr root) ep->domain = e_plugin_xml_prop(root, "domain"); ep->name = e_plugin_xml_prop_domain(root, "name", ep->domain); - printf("creating plugin '%s' '%s'\n", ep->name?ep->name:"un-named", ep->id); + pd(printf("creating plugin '%s' '%s'\n", ep->name?ep->name:"un-named", ep->id)); node = root->children; while (node) { @@ -344,7 +344,7 @@ ep_load(const char *filename) res = 0; fail: if (cache) { - printf("Caching plugin description '%s' for unknown future hooks\n", filename); + pd(printf("Caching plugin description '%s' for unknown future hooks\n", filename)); e_dlist_addtail(&ep_plugin_docs, (EDListNode *)pdoc); } else { xmlFreeDoc(pdoc->doc); @@ -363,7 +363,7 @@ ep_load_pending(EPlugin *ep, EPluginHookClass *type) int res = 0; GSList *l, *p; - printf("New hook type registered '%s', loading pending hooks on plugin '%s'\n", type->id, ep->id); + phd(printf("New hook type registered '%s', loading pending hooks on plugin '%s'\n", type->id, ep->id)); l = ep->hooks_pending; p = NULL; @@ -373,7 +373,7 @@ ep_load_pending(EPlugin *ep, EPluginHookClass *type) char *class = xmlGetProp(node, "class"); EPluginHook *hook; - printf(" checking pending hook '%s'\n", class?class:"<unknown>"); + phd(printf(" checking pending hook '%s'\n", class?class:"<unknown>")); if (class) { if (strcmp(class, type->id) == 0) { @@ -448,7 +448,7 @@ e_plugin_load_plugins(void) struct dirent *d; char *path = l->data; - printf("scanning plugin dir '%s'\n", path); + pd(printf("scanning plugin dir '%s'\n", path)); dir = opendir(path); if (dir == NULL) { @@ -1015,7 +1015,7 @@ e_plugin_hook_register_type(GType type) cache |= (((EPlugin *)l->data)->hooks_pending != NULL); if (!cache) { - printf("Gargabe collecting plugin description\n"); + pd(printf("Gargabe collecting plugin description\n")); e_dlist_remove((EDListNode *)pdoc); xmlFreeDoc(pdoc->doc); g_free(pdoc); diff --git a/e-util/e-popup.c b/e-util/e-popup.c index c336aed9e7..20fe0c82f6 100644 --- a/e-util/e-popup.c +++ b/e-util/e-popup.c @@ -44,6 +44,8 @@ #include <libgnome/gnome-i18n.h> +#define d(x) + struct _EPopupFactory { struct _EPopupFactory *next, *prev; @@ -139,7 +141,7 @@ ep_target_free(EPopup *ep, EPopupTarget *t) static void ep_class_init(GObjectClass *klass) { - printf("EPopup class init %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type)); + d(printf("EPopup class init %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type))); klass->finalize = ep_finalise; ((EPopupClass *)klass)->target_free = ep_target_free; @@ -376,16 +378,13 @@ e_popup_create_menu(EPopup *emp, EPopupTarget *target, guint32 mask) switch (item->type & E_POPUP_TYPE_MASK) { case E_POPUP_ITEM: if (item->image) { - GdkPixbuf *pixbuf; GtkWidget *image; /* work-around e-icon-factory not doing GTK_STOCK stuff */ if (strncmp((char *)item->image, "gtk-", 4) == 0) { image = gtk_image_new_from_stock((char *)item->image, GTK_ICON_SIZE_MENU); } else { - pixbuf = e_icon_factory_get_icon((char *)item->image, E_ICON_SIZE_MENU); - image = gtk_image_new_from_pixbuf(pixbuf); - g_object_unref(pixbuf); + image = e_icon_factory_get_image((char *)item->image, E_ICON_SIZE_MENU); } gtk_widget_show(image); @@ -636,7 +635,7 @@ emph_popup_factory(EPopup *emp, void *data) { struct _EPopupHookMenu *menu = data; - printf("popup factory called %s mask %08x\n", menu->id?menu->id:"all menus", emp->target->mask); + d(printf("popup factory called %s mask %08x\n", menu->id?menu->id:"all menus", emp->target->mask)); /* If we're disabled, then don't add the menu's. */ if (emp->target->type != menu->target_type @@ -672,7 +671,7 @@ emph_construct_item(EPluginHook *eph, EPopupHookMenu *menu, xmlNodePtr root, EPo { struct _EPopupItem *item; - printf(" loading menu item\n"); + d(printf(" loading menu item\n")); item = g_malloc0(sizeof(*item)); if ((item->type = e_plugin_hook_id(root, emph_item_types, "type")) == -1 || item->type == E_POPUP_IMAGE) @@ -689,12 +688,12 @@ emph_construct_item(EPluginHook *eph, EPopupHookMenu *menu, xmlNodePtr root, EPo if (item->user_data == NULL) goto error; - printf(" path=%s\n", item->path); - printf(" label=%s\n", item->label); + d(printf(" path=%s\n", item->path)); + d(printf(" label=%s\n", item->label)); return item; error: - printf("error!\n"); + d(printf("error!\n")); emph_free_item(item); return NULL; } @@ -708,7 +707,7 @@ emph_construct_menu(EPluginHook *eph, xmlNodePtr root) EPopupHookClass *klass = (EPopupHookClass *)G_OBJECT_GET_CLASS(eph); char *tmp; - printf(" loading menu\n"); + d(printf(" loading menu\n")); menu = g_malloc0(sizeof(*menu)); menu->hook = (EPopupHook *)eph; @@ -746,7 +745,7 @@ emph_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) xmlNodePtr node; EPopupClass *klass; - printf("loading popup hook\n"); + d(printf("loading popup hook\n")); if (((EPluginHookClass *)emph_parent_class)->construct(eph, ep, root) == -1) return -1; @@ -792,7 +791,7 @@ emph_class_init(EPluginHookClass *klass) /* this is actually an abstract implementation but list it anyway */ klass->id = "org.gnome.evolution.popup:1.0"; - printf("EPopupHook: init class %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type)); + d(printf("EPopupHook: init class %p '%s'\n", klass, g_type_name(((GObjectClass *)klass)->g_type_class.g_type))); ((EPopupHookClass *)klass)->target_map = g_hash_table_new(g_str_hash, g_str_equal); ((EPopupHookClass *)klass)->popup_class = g_type_class_ref(e_popup_get_type()); |