Index: Makefile.am =================================================================== RCS file: /cvs/gnome/gnome-panel/Makefile.am,v retrieving revision 1.79 diff -u -u -r1.79 Makefile.am --- Makefile.am 12 Dec 2005 18:34:48 -0000 1.79 +++ Makefile.am 27 Feb 2006 11:18:17 -0000 @@ -20,10 +20,10 @@ SUBDIRS = \ po \ - idl \ icons \ - gnome-panel \ libpanel-applet \ + gnome-panel \ + gnome-applets-manager \ applets \ help \ doc \ Index: configure.in =================================================================== RCS file: /cvs/gnome/gnome-panel/configure.in,v retrieving revision 1.647 diff -u -u -r1.647 configure.in --- configure.in 13 Feb 2006 20:10:12 -0000 1.647 +++ configure.in 27 Feb 2006 11:18:17 -0000 @@ -49,8 +49,6 @@ LIBGLADE_REQUIRED=2.5.0 LIBGNOME_REQUIRED=2.13.0 LIBGNOMEUI_REQUIRED=2.5.4 -LIBBONOBOUI_REQUIRED=2.1.1 -ORBIT_REQUIRED=2.4.0 GNOME_VFS_REQUIRED=2.9.1 LIBWNCK_REQUIRED=2.13.5 GCONF_REQUIRED=2.6.1 @@ -58,17 +56,22 @@ LIBECAL_REQUIRED=0.0.97 LIBEDATASERVERUI_REQUIRED=1.2.0 CAIRO_REQUIRED=1.0.0 +DBUS_GLIB=0.60 dnl pkg-config dependency checks -PKG_CHECK_MODULES(PANEL, ORBit-2.0 >= $ORBIT_REQUIRED gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnome-menu >= $LIBGNOME_MENU_REQUIRED) +PKG_CHECK_MODULES(PANEL, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnome-menu >= $LIBGNOME_MENU_REQUIRED dbus-glib-1 >= $DBUS_GLIB) AC_SUBST(PANEL_CFLAGS) AC_SUBST(PANEL_LIBS) -PKG_CHECK_MODULES(LIBPANEL_APPLET, ORBit-2.0 >= $ORBIT_REQUIRED gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED) +PKG_CHECK_MODULES(LIBPANEL_APPLET, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED dbus-glib-1 >= $DBUS_GLIB) AC_SUBST(LIBPANEL_APPLET_CFLAGS) AC_SUBST(LIBPANEL_APPLET_LIBS) +PKG_CHECK_MODULES(APPLETS_MANAGER, gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED dbus-glib-1 >= $DBUS_GLIB) +AC_SUBST(APPLETS_MANAGER_CFLAGS) +AC_SUBST(APPLETS_MANAGER_LIBS) + PKG_CHECK_MODULES(WNCKLET, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED) AC_SUBST(WNCKLET_CFLAGS) AC_SUBST(WNCKLET_LIBS) @@ -97,7 +100,7 @@ fi AM_CONDITIONAL(HAVE_LIBECAL, test -n "$LIBECAL_REQUIREMENT") -PKG_CHECK_MODULES(CLOCK, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED $LIBECAL_REQUIREMENT) +PKG_CHECK_MODULES(CLOCK, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED $LIBECAL_REQUIREMENT dbus-glib-1 >= $DBUS_GLIB) AC_SUBST(CLOCK_CFLAGS) AC_SUBST(CLOCK_LIBS) @@ -145,14 +148,10 @@ dnl IDL directories -ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`" -AC_SUBST(ORBIT_IDL) - -BONOBO_IDLDIR="`$PKG_CONFIG --variable=idldir libbonobo-2.0`" -AC_SUBST(BONOBO_IDLDIR) - -BONOBO_ACT_IDLDIR="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`" -AC_SUBST(BONOBO_ACT_IDLDIR) +AC_PATH_PROG([DBUS_BINDING_TOOL], [dbus-binding-tool], [no]) +if test x$DBUS_BINDING_TOOL = "xno" ; then + AC_MSG_ERROR([dbus-binding-tool executable not found in your path - should be installed with dbus glib bindings]) +fi dnl Language Support @@ -198,12 +197,12 @@ AC_OUTPUT([ Makefile -idl/Makefile icons/Makefile gnome-panel/Makefile libpanel-applet/libpanelapplet-2.0.pc libpanel-applet/libpanelapplet-2.0-uninstalled.pc libpanel-applet/Makefile +gnome-applets-manager/Makefile po/Makefile.in applets/Makefile applets/clock/Makefile Index: applets/clock/GNOME_ClockApplet.xml =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/clock/GNOME_ClockApplet.xml,v retrieving revision 1.9 diff -u -u -r1.9 GNOME_ClockApplet.xml --- applets/clock/GNOME_ClockApplet.xml 11 Jun 2004 10:53:16 -0000 1.9 +++ applets/clock/GNOME_ClockApplet.xml 27 Feb 2006 11:18:17 -0000 @@ -1,20 +1,11 @@ - - - - - + + + + - - - - - - - + + + + + + Index: applets/clock/Makefile.am =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/clock/Makefile.am,v retrieving revision 1.71 diff -u -u -r1.71 Makefile.am --- applets/clock/Makefile.am 4 Nov 2004 17:11:10 -0000 1.71 +++ applets/clock/Makefile.am 27 Feb 2006 11:18:17 -0000 @@ -28,17 +28,17 @@ libexec_PROGRAMS = clock-applet -GNOME_ClockApplet_Factory.server.in: GNOME_ClockApplet_Factory.server.in.in +org.gnome.panel.applet.Clock.service.in: org.gnome.panel.applet.Clock.service.in.in sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ uidir = $(datadir)/gnome-2.0/ui ui_DATA = GNOME_ClockApplet.xml -serverdir = $(libdir)/bonobo/servers -server_in_files = GNOME_ClockApplet_Factory.server.in -server_DATA = $(server_in_files:.server.in=.server) +servicedir = $(datadir)/dbus-1/services +service_in_files = org.gnome.panel.applet.Clock.service.in +service_DATA = $(service_in_files:.service.in=.service) -@INTLTOOL_SERVER_RULE@ +@INTLTOOL_SERVICE_RULE@ schemasdir = $(GCONF_SCHEMA_FILE_DIR) schemas_in_files = clock.schemas.in @@ -59,8 +59,8 @@ endif EXTRA_DIST = \ - GNOME_ClockApplet_Factory.server.in.in \ + org.gnome.panel.applet.Clock.service.in.in \ $(schemas_in_files) \ $(ui_DATA) -CLEANFILES = $(server_in_files) $(server_DATA) $(schemas_DATA) +CLEANFILES = $(service_in_files) $(service_DATA) $(schemas_DATA) Index: applets/clock/clock.c =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/clock/clock.c,v retrieving revision 1.181 diff -u -u -r1.181 clock.c --- applets/clock/clock.c 22 Jan 2006 17:23:29 -0000 1.181 +++ applets/clock/clock.c 27 Feb 2006 11:18:17 -0000 @@ -50,11 +50,12 @@ #include #include +#include #include #include +#include #include -#include #include #include #include @@ -167,15 +168,13 @@ static void set_atk_name_description (GtkWidget *widget, const char *name, const char *desc); -static void display_properties_dialog (BonoboUIComponent *uic, - ClockData *cd, - const gchar *verbname); -static void display_help_dialog (BonoboUIComponent *uic, - ClockData *cd, - const gchar *verbname); -static void display_about_dialog (BonoboUIComponent *uic, - ClockData *cd, - const gchar *verbname); + +static void display_properties_dialog (GtkAction *action, + ClockData *cd); +static void display_help_dialog (GtkAction *action, + ClockData *cd); +static void display_about_dialog (GtkAction *action, + ClockData *cd); static void position_calendar_popup (ClockData *cd, GtkWidget *window, GtkWidget *button); @@ -1341,7 +1340,7 @@ update_frame_visibility (cd->appointment_list, GTK_TREE_MODEL (cd->appointments_model)); switch (cd->orient) { - case PANEL_APPLET_ORIENT_UP: + case PANEL_APPLET_ORIENT_DOWN: gtk_box_pack_start (GTK_BOX (vbox), cd->appointment_list, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), cd->task_list, TRUE, TRUE, 0); break; @@ -1431,7 +1430,7 @@ gtk_calendar_select_day (GTK_CALENDAR (cd->calendar), tm->tm_mday); switch (cd->orient) { - case PANEL_APPLET_ORIENT_UP: + case PANEL_APPLET_ORIENT_DOWN: add_appointments_and_tasks (cd, vbox); gtk_box_pack_start (GTK_BOX (vbox), cd->calendar, TRUE, FALSE, 0); break; @@ -1494,11 +1493,9 @@ /* Based on panel orientation, position the popup. * Ignore window gravity since the window is undecorated. - * The orientations are all named backward from what - * I expected. */ switch (cd->orient) { - case PANEL_APPLET_ORIENT_RIGHT: + case PANEL_APPLET_ORIENT_LEFT: x += button_w; if ((y + h) > monitor.y + monitor.height) y -= (y + h) - (monitor.y + monitor.height); @@ -1509,7 +1506,7 @@ gravity = GDK_GRAVITY_NORTH_WEST; break; - case PANEL_APPLET_ORIENT_LEFT: + case PANEL_APPLET_ORIENT_RIGHT: x -= w; if ((y + h) > monitor.y + monitor.height) y -= (y + h) - (monitor.y + monitor.height); @@ -1520,7 +1517,7 @@ gravity = GDK_GRAVITY_NORTH_EAST; break; - case PANEL_APPLET_ORIENT_DOWN: + case PANEL_APPLET_ORIENT_UP: y += button_h; if ((x + w) > monitor.x + monitor.width) x -= (x + w) - (monitor.x + monitor.width); @@ -1528,7 +1525,7 @@ gravity = GDK_GRAVITY_NORTH_WEST; break; - case PANEL_APPLET_ORIENT_UP: + case PANEL_APPLET_ORIENT_DOWN: y -= h; if ((x + w) > monitor.x + monitor.width) x -= (x + w) - (monitor.x + monitor.width); @@ -1680,9 +1677,9 @@ /* Initialize label orientation */ if (cd->orient == PANEL_APPLET_ORIENT_RIGHT) - gtk_label_set_angle (GTK_LABEL (cd->clockw), 90); - else if (cd->orient == PANEL_APPLET_ORIENT_LEFT) gtk_label_set_angle (GTK_LABEL (cd->clockw), 270); + else if (cd->orient == PANEL_APPLET_ORIENT_LEFT) + gtk_label_set_angle (GTK_LABEL (cd->clockw), 90); else gtk_label_set_angle (GTK_LABEL (cd->clockw), 0); @@ -1709,9 +1706,9 @@ cd->orient = orient; if (cd->orient == PANEL_APPLET_ORIENT_RIGHT) - gtk_label_set_angle (GTK_LABEL (cd->clockw), 90); - else if (cd->orient == PANEL_APPLET_ORIENT_LEFT) gtk_label_set_angle (GTK_LABEL (cd->clockw), 270); + else if (cd->orient == PANEL_APPLET_ORIENT_LEFT) + gtk_label_set_angle (GTK_LABEL (cd->clockw), 90); else gtk_label_set_angle (GTK_LABEL (cd->clockw), 0); @@ -1745,9 +1742,8 @@ } static void -copy_time (BonoboUIComponent *uic, - ClockData *cd, - const gchar *verbname) +copy_time (GtkAction *action, + ClockData *cd) { char string[256]; char *utf8; @@ -1801,9 +1797,8 @@ } static void -copy_date (BonoboUIComponent *uic, - ClockData *cd, - const gchar *verbname) +copy_date (GtkAction *action, + ClockData *cd) { struct tm *tm; char string[256]; @@ -1886,9 +1881,8 @@ } static void -config_date (BonoboUIComponent *uic, - ClockData *cd, - const char *verbname) +config_date (GtkAction *action, + ClockData *cd) { GtkWidget *dialog; GdkScreen *screen; @@ -1919,15 +1913,25 @@ gtk_widget_show_all (dialog); } -/* current timestamp */ -static const BonoboUIVerb clock_menu_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("ClockPreferences", display_properties_dialog), - BONOBO_UI_UNSAFE_VERB ("ClockHelp", display_help_dialog), - BONOBO_UI_UNSAFE_VERB ("ClockAbout", display_about_dialog), - BONOBO_UI_UNSAFE_VERB ("ClockCopyTime", copy_time), - BONOBO_UI_UNSAFE_VERB ("ClockCopyDate", copy_date), - BONOBO_UI_UNSAFE_VERB ("ClockConfig", config_date), - BONOBO_UI_VERB_END +static const GtkActionEntry clock_menu_actions [] = { + { "ClockPreferences", GTK_STOCK_PROPERTIES, N_("_Preferences"), + NULL, NULL, + G_CALLBACK (display_properties_dialog) }, + { "ClockHelp", GTK_STOCK_HELP, N_("_Help"), + NULL, NULL, + G_CALLBACK (display_help_dialog) }, + { "ClockAbout", GTK_STOCK_ABOUT, N_("_About"), + NULL, NULL, + G_CALLBACK (display_about_dialog) }, + { "ClockCopyTime", GTK_STOCK_COPY, N_("Copy _Time"), + NULL, NULL, + G_CALLBACK (copy_time) }, + { "ClockCopyDate", GTK_STOCK_COPY, N_("Copy _Date"), + NULL, NULL, + G_CALLBACK (copy_date) }, + { "ClockConfig", GTK_STOCK_PREFERENCES, N_("Ad_just Date & Time"), + NULL, NULL, + G_CALLBACK (config_date) }, }; static void @@ -1938,7 +1942,7 @@ { const char *value; int new_format; - + if (!entry->value || entry->value->type != GCONF_VALUE_STRING) return; @@ -1959,9 +1963,9 @@ static void show_seconds_changed (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - ClockData *clock) + guint cnxn_id, + GConfEntry *entry, + ClockData *clock) { gboolean value; @@ -2218,11 +2222,12 @@ fill_clock_applet (PanelApplet *applet) { ClockData *cd; - BonoboUIComponent *popup_component; + PanelAppletMenu *popup_menu; + GtkAction *action; GError *error; int format; char *format_str; - + panel_applet_add_preferences (applet, "/schemas/apps/clock_applet/prefs", NULL); panel_applet_set_flags (applet, PANEL_APPLET_EXPAND_MINOR); @@ -2298,25 +2303,24 @@ panel_applet_set_background_widget (PANEL_APPLET (cd->applet), GTK_WIDGET (cd->applet)); - panel_applet_setup_menu_from_file (PANEL_APPLET (cd->applet), - NULL, - "GNOME_ClockApplet.xml", - NULL, - clock_menu_verbs, - cd); - - popup_component = panel_applet_get_popup_component (PANEL_APPLET (cd->applet)); + popup_menu = panel_applet_get_menu (PANEL_APPLET (cd->applet)); + + panel_applet_menu_add_actions (popup_menu, + clock_menu_actions, + G_N_ELEMENTS (clock_menu_actions), + cd); + panel_applet_menu_add_ui_from_file (popup_menu, + NULL, + "GNOME_ClockApplet.xml", + NULL); if (panel_applet_get_locked_down (PANEL_APPLET (cd->applet))) { - bonobo_ui_component_set_prop (popup_component, - "/commands/ClockPreferences", - "hidden", "1", - NULL); - bonobo_ui_component_set_prop (popup_component, - "/commands/ClockConfig", - "hidden", "1", - NULL); - } + action = panel_applet_menu_get_action (popup_menu, "ClockPreferences"); + gtk_action_set_visible (action, FALSE); + + action = panel_applet_menu_get_action (popup_menu, "ClockConfig"); + gtk_action_set_visible (action, FALSE); + } if (!check_config_tool_command (cd->config_tool)) { g_free (cd->config_tool); @@ -2333,10 +2337,8 @@ } } - bonobo_ui_component_set_prop (popup_component, - "/commands/ClockConfig", - "hidden", cd->config_tool ? "0" : "1", - NULL); + action = panel_applet_menu_get_action (popup_menu, "ClockConfig"); + gtk_action_set_visible (action, (cd->config_tool != NULL)); return TRUE; } @@ -2528,9 +2530,8 @@ } static void -display_properties_dialog (BonoboUIComponent *uic, - ClockData *cd, - const gchar *verbname) +display_properties_dialog (GtkAction *action, + ClockData *cd) { GtkWidget *hbox; GtkWidget *vbox; @@ -2668,9 +2669,8 @@ } static void -display_help_dialog (BonoboUIComponent *uic, - ClockData *cd, - const gchar *verbname) +display_help_dialog (GtkAction *action, + ClockData *cd) { GError *error = NULL; static GnomeProgram *applet_program = NULL; @@ -2709,9 +2709,8 @@ } static void -display_about_dialog (BonoboUIComponent *uic, - ClockData *cd, - const gchar *verbname) +display_about_dialog (GtkAction *action, + ClockData *cd) { static const gchar *authors[] = { @@ -2761,15 +2760,15 @@ { gboolean retval = FALSE; - if (!strcmp (iid, "OAFIID:GNOME_ClockApplet")) - retval = fill_clock_applet (applet); + if (!strcmp (iid, "Clock")) + retval = fill_clock_applet (applet); return retval; } -PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_ClockApplet_Factory", - PANEL_TYPE_APPLET, - "ClockApplet", - "0", - clock_factory, - NULL); +PANEL_APPLET_FACTORY_MAIN ("Clock", + PANEL_TYPE_APPLET, + "Clock", + "0", + clock_factory, + NULL); Index: applets/fish/GNOME_FishApplet.xml =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/fish/GNOME_FishApplet.xml,v retrieving revision 1.5 diff -u -u -r1.5 GNOME_FishApplet.xml --- applets/fish/GNOME_FishApplet.xml 11 Jun 2004 10:53:16 -0000 1.5 +++ applets/fish/GNOME_FishApplet.xml 27 Feb 2006 11:18:17 -0000 @@ -1,12 +1,8 @@ - - - - - - - - - + + + + + + + + Index: applets/fish/Makefile.am =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/fish/Makefile.am,v retrieving revision 1.42 diff -u -u -r1.42 Makefile.am --- applets/fish/Makefile.am 30 Oct 2004 21:04:57 -0000 1.42 +++ applets/fish/Makefile.am 27 Feb 2006 11:18:17 -0000 @@ -23,12 +23,12 @@ footguy.png \ monkey.png -EXTRA_DIST = \ - $(FISH_BITMAPS) \ - GNOME_FishApplet_Factory.server.in.in \ - gnome-fish.png \ - fish.schemas.in \ - $(ui_DATA) \ +EXTRA_DIST = \ + $(FISH_BITMAPS) \ + org.gnome.panel.applet.Fish.service.in.in \ + gnome-fish.png \ + fish.schemas.in \ + $(ui_DATA) \ $(glade_DATA) gladedir = $(datadir)/gnome/panel/glade @@ -43,16 +43,16 @@ uidir = $(datadir)/gnome-2.0/ui ui_DATA = GNOME_FishApplet.xml -serverdir = $(libdir)/bonobo/servers -server_in_files = GNOME_FishApplet_Factory.server.in -server_DATA = $(server_in_files:.server.in=.server) +servicedir = $(datadir)/dbus-1/services +service_in_files = org.gnome.panel.applet.Fish.service.in +service_DATA = $(service_in_files:.service.in=.service) -$(server_in_files): $(server_in_files).in +org.gnome.panel.applet.Fish.service.in: org.gnome.panel.applet.Fish.service.in.in sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ -CLEANFILES = $(server_DATA) $(server_DATA).in $(schemas_DATA) +CLEANFILES = $(service_DATA) $(service_DATA).in $(schemas_DATA) -@INTLTOOL_SERVER_RULE@ +@INTLTOOL_SERVICE_RULE@ schemasdir = $(GCONF_SCHEMA_FILE_DIR) schemas_in_files = fish.schemas.in Index: applets/fish/fish.c =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/fish/fish.c,v retrieving revision 1.134 diff -u -u -r1.134 fish.c --- applets/fish/fish.c 12 Feb 2006 12:40:13 -0000 1.134 +++ applets/fish/fish.c 27 Feb 2006 11:18:17 -0000 @@ -31,9 +31,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -380,10 +382,9 @@ have_preview); } -static void -display_preferences_dialog (BonoboUIComponent *uic, - FishApplet *fish, - const char *verbname) +static void +display_preferences_dialog (GtkAction *action, + FishApplet *fish) { GladeXML *xml; GtkWidget *button; @@ -530,17 +531,15 @@ } static void -display_help_dialog (BonoboUIComponent *uic, - FishApplet *fish, - const char *verbname) +display_help_dialog (GtkAction *action, + FishApplet *fish) { show_help (fish, NULL); } static void -display_about_dialog (BonoboUIComponent *uic, - FishApplet *fish, - const char *verbname) +display_about_dialog (GtkAction *action, + FishApplet *fish) { const char *author_format = _("%s the Fish"); const char *about_format = _("%s has no use what-so-ever. " @@ -1768,12 +1767,16 @@ gtk_widget_show_all (widget); } -static const BonoboUIVerb fish_menu_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("FishPreferences", display_preferences_dialog), - BONOBO_UI_UNSAFE_VERB ("FishHelp", display_help_dialog), - BONOBO_UI_UNSAFE_VERB ("FishAbout", display_about_dialog), - - BONOBO_UI_VERB_END +static const GtkActionEntry fish_menu_actions [] = { + { "FishPreferences", GTK_STOCK_PROPERTIES, N_("_Preferences"), + NULL, NULL, + G_CALLBACK (display_preferences_dialog) }, + { "FishHelp", GTK_STOCK_HELP, N_("_Help"), + NULL, NULL, + G_CALLBACK (display_help_dialog) }, + { "FishAbout", GTK_STOCK_ABOUT, N_("_About"), + NULL, NULL, + G_CALLBACK (display_about_dialog) }, }; static void @@ -1795,8 +1798,9 @@ static gboolean fish_applet_fill (FishApplet *fish) { - PanelApplet *applet = (PanelApplet *) fish; - GError *error = NULL; + PanelApplet *applet = (PanelApplet *) fish; + PanelAppletMenu *popup_menu; + GError *error = NULL; fish->orientation = panel_applet_get_orient (applet); @@ -1860,19 +1864,22 @@ fish->rotate = FALSE; /* Fallback */ } - panel_applet_setup_menu_from_file ( - applet, NULL, "GNOME_FishApplet.xml", - NULL, fish_menu_verbs, fish); + popup_menu = panel_applet_get_menu (PANEL_APPLET (applet)); - if (panel_applet_get_locked_down (applet)) { - BonoboUIComponent *popup_component; + panel_applet_menu_add_actions (popup_menu, + fish_menu_actions, + G_N_ELEMENTS (fish_menu_actions), + applet); + panel_applet_menu_add_ui_from_file (popup_menu, + NULL, + "GNOME_FishApplet.xml", + NULL); - popup_component = panel_applet_get_popup_component (applet); + if (panel_applet_get_locked_down (applet)) { + GtkAction *action; - bonobo_ui_component_set_prop (popup_component, - "/commands/FishPreferences", - "hidden", "1", - NULL); + action = panel_applet_menu_get_action (popup_menu, "FishPreferences"); + gtk_action_set_visible (action, FALSE); } gtk_window_set_default_icon_name ("gnome-fish"); @@ -1888,7 +1895,7 @@ { gboolean retval = FALSE; - if (!strcmp (iid, "OAFIID:GNOME_FishApplet")) + if (!strcmp (iid, "Fish")) retval = fish_applet_fill (FISH_APPLET (applet)); return retval; @@ -2061,9 +2068,11 @@ return type; } -PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_FishApplet_Factory", - fish_applet_get_type (), - "That-stupid-fish", - "0", - fishy_factory, - NULL) +PANEL_APPLET_FACTORY_MAIN ("Fish", + fish_applet_get_type (), + "That-stupid-fish", + "0", + fishy_factory, + NULL) + + Index: applets/notification_area/GNOME_NotificationAreaApplet.xml =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/notification_area/GNOME_NotificationAreaApplet.xml,v retrieving revision 1.2 diff -u -u -r1.2 GNOME_NotificationAreaApplet.xml --- applets/notification_area/GNOME_NotificationAreaApplet.xml 11 Jun 2004 10:53:16 -0000 1.2 +++ applets/notification_area/GNOME_NotificationAreaApplet.xml 27 Feb 2006 11:18:17 -0000 @@ -1,10 +1,7 @@ - - - - - - - - + + + + + + + Index: applets/notification_area/Makefile.am =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/notification_area/Makefile.am,v retrieving revision 1.8 diff -u -u -r1.8 Makefile.am --- applets/notification_area/Makefile.am 30 Oct 2004 21:04:57 -0000 1.8 +++ applets/notification_area/Makefile.am 27 Feb 2006 11:18:17 -0000 @@ -35,20 +35,20 @@ $(X_LIBS) \ $(PANEL_LIBS) -serverdir = $(libdir)/bonobo/servers -server_in_files = GNOME_NotificationAreaApplet.server.in -server_DATA = GNOME_NotificationAreaApplet.server - -GNOME_NotificationAreaApplet.server.in: $(srcdir)/GNOME_NotificationAreaApplet.server.in.in +org.gnome.panel.applet.NotificationArea.service.in: org.gnome.panel.applet.NotificationArea.service.in.in sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ -@INTLTOOL_SERVER_RULE@ +servicedir = $(datadir)/dbus-1/services +service_in_files = org.gnome.panel.applet.NotificationArea.service.in +service_DATA = $(service_in_files:.service.in=.service) + +@INTLTOOL_SERVICE_RULE@ uidir = $(datadir)/gnome-2.0/ui ui_DATA = GNOME_NotificationAreaApplet.xml EXTRA_DIST = \ - GNOME_NotificationAreaApplet.server.in.in \ + org.gnome.panel.applet.NotificationArea.service.in.in \ $(ui_DATA) \ update-from-egg.sh \ eggmarshalers.list @@ -57,9 +57,7 @@ BUILT_SOURCES = eggmarshalers.c eggmarshalers.h -CLEANFILES = \ - GNOME_NotificationAreaApplet.server.in \ - GNOME_NotificationAreaApplet.server +CLEANFILES = $(service_in_files) $(service_DATA) regenerate-built-sources: EGGFILES="$(EGGFILES)" EGGDIR="$(EGGDIR)" $(srcdir)/update-from-egg.sh Index: applets/notification_area/main.c =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/notification_area/main.c,v retrieving revision 1.30 diff -u -u -r1.30 main.c --- applets/notification_area/main.c 28 Dec 2005 21:15:27 -0000 1.30 +++ applets/notification_area/main.c 27 Feb 2006 11:18:17 -0000 @@ -24,14 +24,13 @@ #include #include +#include #include #include #include #include -#include - #include "eggtraymanager.h" #include "fixedtip.h" #include "obox.h" @@ -59,9 +58,8 @@ } SystemTray; static void -help_cb (BonoboUIComponent *uic, - SystemTray *tray, - const gchar *verbname) +help_cb (GtkAction *action, + SystemTray *tray) { GError *err; @@ -96,11 +94,9 @@ } } - static void -about_cb (BonoboUIComponent *uic, - SystemTray *tray, - const gchar *verbname) +about_cb (GtkAction *action, + SystemTray *tray) { GdkScreen *screen; @@ -142,10 +138,13 @@ gtk_widget_show (tray->about_dialog); } -static const BonoboUIVerb menu_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("SystemTrayHelp", help_cb), - BONOBO_UI_UNSAFE_VERB ("SystemTrayAbout", about_cb), - BONOBO_UI_VERB_END +static const GtkActionEntry menu_actions [] = { + { "SystemTrayHelp", GTK_STOCK_HELP, N_("_Help"), + NULL, NULL, + G_CALLBACK (help_cb) }, + { "SystemTrayAbout", GTK_STOCK_ABOUT, N_("_About"), + NULL, NULL, + G_CALLBACK (about_cb) }, }; static void @@ -266,11 +265,12 @@ const gchar *iid, gpointer data) { - SystemTray *tray; - AtkObject *atko; + SystemTray *tray; + AtkObject *atko; + PanelAppletMenu *popup_menu; - if (!(strcmp (iid, "OAFIID:GNOME_NotificationAreaApplet") == 0 || - strcmp (iid, "OAFIID:GNOME_SystemTrayApplet") == 0)) + if (!(strcmp (iid, "NotificationArea") == 0 || + strcmp (iid, "SystemTrayApplet") == 0)) return FALSE; if (tray_manager == NULL) @@ -347,25 +347,27 @@ gtk_window_set_default_icon_name ("panel-notification-area"); gtk_widget_show_all (GTK_WIDGET (tray->applet)); - - panel_applet_setup_menu_from_file (PANEL_APPLET (applet), - NULL, - "GNOME_NotificationAreaApplet.xml", - NULL, - menu_verbs, - tray); - + + popup_menu = panel_applet_get_menu (PANEL_APPLET (tray->applet)); + + panel_applet_menu_add_actions (popup_menu, + menu_actions, + G_N_ELEMENTS (menu_actions), + tray); + panel_applet_menu_add_ui_from_file (popup_menu, + NULL, + "GNOME_NotificationAreaApplet.xml", + NULL); return TRUE; } #if 1 -PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_NotificationAreaApplet_Factory", - PANEL_TYPE_APPLET, - "NotificationArea", - "0", - applet_factory, - NULL) - +PANEL_APPLET_FACTORY_MAIN ("NotificationArea", + PANEL_TYPE_APPLET, + "NotificationArea", + "0", + applet_factory, + NULL) #else PANEL_APPLET_BONOBO_SHLIB_FACTORY ("OAFIID:GNOME_NotificationAreaApplet_Factory", Index: applets/wncklet/GNOME_ShowDesktopApplet.xml =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/GNOME_ShowDesktopApplet.xml,v retrieving revision 1.2 diff -u -u -r1.2 GNOME_ShowDesktopApplet.xml --- applets/wncklet/GNOME_ShowDesktopApplet.xml 11 Jun 2004 10:53:17 -0000 1.2 +++ applets/wncklet/GNOME_ShowDesktopApplet.xml 27 Feb 2006 11:18:17 -0000 @@ -1,10 +1,6 @@ - - - - - - - - + + + + + + Index: applets/wncklet/GNOME_WindowListApplet.xml =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/GNOME_WindowListApplet.xml,v retrieving revision 1.4 diff -u -u -r1.4 GNOME_WindowListApplet.xml --- applets/wncklet/GNOME_WindowListApplet.xml 11 Jun 2004 10:53:17 -0000 1.4 +++ applets/wncklet/GNOME_WindowListApplet.xml 27 Feb 2006 11:18:17 -0000 @@ -1,15 +1,10 @@ - - - - - - - - - + + + + + + + Index: applets/wncklet/GNOME_WindowMenuApplet.xml =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/GNOME_WindowMenuApplet.xml,v retrieving revision 1.2 diff -u -u -r1.2 GNOME_WindowMenuApplet.xml --- applets/wncklet/GNOME_WindowMenuApplet.xml 11 Jun 2004 10:53:17 -0000 1.2 +++ applets/wncklet/GNOME_WindowMenuApplet.xml 27 Feb 2006 11:18:17 -0000 @@ -1,10 +1,6 @@ - - - - - - - - + + + + + + Index: applets/wncklet/GNOME_WorkspaceSwitcherApplet.xml =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/GNOME_WorkspaceSwitcherApplet.xml,v retrieving revision 1.5 diff -u -u -r1.5 GNOME_WorkspaceSwitcherApplet.xml --- applets/wncklet/GNOME_WorkspaceSwitcherApplet.xml 11 Jun 2004 10:53:17 -0000 1.5 +++ applets/wncklet/GNOME_WorkspaceSwitcherApplet.xml 27 Feb 2006 11:18:17 -0000 @@ -1,14 +1,9 @@ - - - - - - - - - + + + + + + + Index: applets/wncklet/Makefile.am =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/Makefile.am,v retrieving revision 1.16 diff -u -u -r1.16 Makefile.am --- applets/wncklet/Makefile.am 29 Jan 2005 00:08:01 -0000 1.16 +++ applets/wncklet/Makefile.am 27 Feb 2006 11:18:17 -0000 @@ -35,21 +35,21 @@ $(WNCKLET_LIBS) EXTRA_DIST = \ - GNOME_Wncklet_Factory.server.in.in \ + org.gnome.panel.applet.Wncklet.service.in.in \ $(ui_DATA) \ $(schemas_in_files) \ $(glade_DATA) -serverdir = $(libdir)/bonobo/servers -server_in_files = GNOME_Wncklet_Factory.server.in -server_DATA = $(server_in_files:.server.in=.server) +org.gnome.panel.applet.Wncklet.service.in: org.gnome.panel.applet.Wncklet.service.in.in + sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ -$(server_in_files): $(server_in_files).in - sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ +servicedir = $(datadir)/dbus-1/services +service_in_files = org.gnome.panel.applet.Wncklet.service.in +service_DATA = $(service_in_files:.service.in=.service) -@INTLTOOL_SERVER_RULE@ +@INTLTOOL_SERVICE_RULE@ -CLEANFILES = $(server_in_files) $(server_DATA) $(BUILT_SOURCES) $(schemas_DATA) +CLEANFILES = $(service_in_files) $(service_DATA) $(BUILT_SOURCES) $(schemas_DATA) uidir = $(datadir)/gnome-2.0/ui ui_DATA = \ Index: applets/wncklet/showdesktop.c =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/showdesktop.c,v retrieving revision 1.32 diff -u -u -r1.32 showdesktop.c --- applets/wncklet/showdesktop.c 28 Dec 2005 21:18:36 -0000 1.32 +++ applets/wncklet/showdesktop.c 27 Feb 2006 11:18:17 -0000 @@ -63,12 +63,10 @@ GtkIconTheme *icon_theme; } ShowDesktopData; -static void display_help_dialog (BonoboUIComponent *uic, - ShowDesktopData *sdd, - const gchar *verbname); -static void display_about_dialog (BonoboUIComponent *uic, - ShowDesktopData *sdd, - const gchar *verbname); +static void display_help_dialog (GtkAction *action, + ShowDesktopData *sdd); +static void display_about_dialog (GtkAction *action, + ShowDesktopData *sdd); static void update_icon (ShowDesktopData *sdd); static void update_button_state (ShowDesktopData *sdd); @@ -202,10 +200,13 @@ g_object_unref (icon); } -static const BonoboUIVerb show_desktop_menu_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("ShowDesktopHelp", display_help_dialog), - BONOBO_UI_UNSAFE_VERB ("ShowDesktopAbout", display_about_dialog), - BONOBO_UI_VERB_END +static const GtkActionEntry show_desktop_menu_actions [] = { + { "ShowDesktopHelp", GTK_STOCK_HELP, N_("_Help"), + NULL, NULL, + G_CALLBACK (display_help_dialog) }, + { "ShowDesktopAbout", GTK_STOCK_ABOUT, N_("_About"), + NULL, NULL, + G_CALLBACK (display_about_dialog) }, }; /* This updates things that should be consistent with the button's appearance, @@ -386,6 +387,7 @@ show_desktop_applet_fill (PanelApplet *applet) { ShowDesktopData *sdd; + PanelAppletMenu *popup_menu; AtkObject *atk_obj; panel_applet_set_flags (applet, PANEL_APPLET_EXPAND_MINOR); @@ -444,12 +446,16 @@ panel_applet_set_background_widget (PANEL_APPLET (sdd->applet), GTK_WIDGET (sdd->applet)); - panel_applet_setup_menu_from_file (PANEL_APPLET (sdd->applet), - NULL, - "GNOME_ShowDesktopApplet.xml", - NULL, - show_desktop_menu_verbs, - sdd); + popup_menu = panel_applet_get_menu (PANEL_APPLET (sdd->applet)); + + panel_applet_menu_add_actions (popup_menu, + show_desktop_menu_actions, + G_N_ELEMENTS (show_desktop_menu_actions), + sdd); + panel_applet_menu_add_ui_from_file (popup_menu, + NULL, + "GNOME_ShowDesktopApplet.xml", + NULL); g_signal_connect (G_OBJECT (sdd->applet), "destroy", @@ -471,18 +477,16 @@ } static void -display_help_dialog (BonoboUIComponent *uic, - ShowDesktopData *sdd, - const gchar *verbname) +display_help_dialog (GtkAction *action, + ShowDesktopData *sdd) { wncklet_display_help (sdd->applet, "user-guide", "user-guide.xml", "gospanel-564"); } static void -display_about_dialog (BonoboUIComponent *uic, - ShowDesktopData *sdd, - const gchar *verbname) +display_about_dialog (GtkAction *action, + ShowDesktopData *sdd) { static const gchar *authors[] = { "Havoc Pennington ", Index: applets/wncklet/window-list.c =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/window-list.c,v retrieving revision 1.76 diff -u -u -r1.76 window-list.c --- applets/wncklet/window-list.c 28 Dec 2005 21:18:36 -0000 1.76 +++ applets/wncklet/window-list.c 27 Feb 2006 11:18:17 -0000 @@ -16,7 +16,6 @@ #include -#include #include #include @@ -64,15 +63,12 @@ guint listeners [5]; } TasklistData; -static void display_properties_dialog (BonoboUIComponent *uic, - TasklistData *tasklist, - const gchar *verbname); -static void display_help_dialog (BonoboUIComponent *uic, - TasklistData *tasklist, - const gchar *verbname); -static void display_about_dialog (BonoboUIComponent *uic, - TasklistData *tasklist, - const gchar *verbname); +static void display_properties_dialog (GtkAction *action, + TasklistData *tasklist); +static void display_help_dialog (GtkAction *action, + TasklistData *tasklist); +static void display_about_dialog (GtkAction *action, + TasklistData *tasklist); static void tasklist_update (TasklistData *tasklist) @@ -246,11 +242,16 @@ g_free (tasklist); } -static const BonoboUIVerb tasklist_menu_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("TasklistPreferences", display_properties_dialog), - BONOBO_UI_UNSAFE_VERB ("TasklistHelp", display_help_dialog), - BONOBO_UI_UNSAFE_VERB ("TasklistAbout", display_about_dialog), - BONOBO_UI_VERB_END +static const GtkActionEntry tasklist_menu_actions [] = { + { "TasklistPreferences", GTK_STOCK_PROPERTIES, N_("_Preferences"), + NULL, NULL, + G_CALLBACK (display_properties_dialog) }, + { "TasklistHelp", GTK_STOCK_HELP, N_("_Help"), + NULL, NULL, + G_CALLBACK (display_help_dialog) }, + { "TasklistAbout", GTK_STOCK_ABOUT, N_("_About"), + NULL, NULL, + G_CALLBACK (display_about_dialog) }, }; static void @@ -611,6 +612,7 @@ window_list_applet_fill (PanelApplet *applet) { TasklistData *tasklist; + PanelAppletMenu *popup_menu; GError *error; GConfValue *value; @@ -730,26 +732,26 @@ "change_background", G_CALLBACK (applet_change_background), tasklist); - + panel_applet_set_background_widget (PANEL_APPLET (tasklist->applet), GTK_WIDGET (tasklist->applet)); - - panel_applet_setup_menu_from_file (PANEL_APPLET (tasklist->applet), - NULL, - "GNOME_WindowListApplet.xml", - NULL, - tasklist_menu_verbs, - tasklist); - if (panel_applet_get_locked_down (PANEL_APPLET (tasklist->applet))) { - BonoboUIComponent *popup_component; + popup_menu = panel_applet_get_menu (PANEL_APPLET (tasklist->applet)); - popup_component = panel_applet_get_popup_component (PANEL_APPLET (tasklist->applet)); + panel_applet_menu_add_actions (popup_menu, + tasklist_menu_actions, + G_N_ELEMENTS (tasklist_menu_actions), + tasklist); + panel_applet_menu_add_ui_from_file (popup_menu, + NULL, + "GNOME_WindowListApplet.xml", + NULL); - bonobo_ui_component_set_prop (popup_component, - "/commands/TasklistPreferences", - "hidden", "1", - NULL); + if (panel_applet_get_locked_down (PANEL_APPLET (tasklist->applet))) { + GtkAction *action; + + action = panel_applet_menu_get_action (popup_menu, "TasklistPreferences"); + gtk_action_set_visible (action, FALSE); } gtk_widget_show (tasklist->applet); @@ -759,18 +761,16 @@ static void -display_help_dialog (BonoboUIComponent *uic, - TasklistData *tasklist, - const gchar *verbname) +display_help_dialog (GtkAction *action, + TasklistData *tasklist) { wncklet_display_help (tasklist->applet, "window-list", "window-list", NULL); } static void -display_about_dialog (BonoboUIComponent *uic, - TasklistData *tasklist, - const gchar *verbname) +display_about_dialog (GtkAction *action, + TasklistData *tasklist) { static const gchar *authors[] = { @@ -1011,12 +1011,9 @@ g_object_unref (G_OBJECT (client)); } - - -static void -display_properties_dialog (BonoboUIComponent *uic, - TasklistData *tasklist, - const gchar *verbname) +static void +display_properties_dialog (GtkAction *action, + TasklistData *tasklist) { if (tasklist->properties_dialog == NULL) { GladeXML *xml; Index: applets/wncklet/window-menu.c =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/window-menu.c,v retrieving revision 1.40 diff -u -u -r1.40 window-menu.c --- applets/wncklet/window-menu.c 13 Feb 2006 07:38:07 -0000 1.40 +++ applets/wncklet/window-menu.c 27 Feb 2006 11:18:17 -0000 @@ -49,18 +49,16 @@ } WindowMenu; static void -window_menu_help (BonoboUIComponent *uic, - WindowMenu *window_menu, - const char *verb) +window_menu_help (GtkAction *action, + WindowMenu *window_menu) { wncklet_display_help (window_menu->applet, "user-guide", "user-guide.xml", "panel-windowselector"); } static void -window_menu_about (BonoboUIComponent *uic, - WindowMenu *window_menu, - const char *verb) +window_menu_about (GtkAction *action, + WindowMenu *window_menu) { static const char *authors[] = { "Mark McLoughlin ", @@ -88,11 +86,13 @@ "WindowMenu"); } -static const BonoboUIVerb window_menu_verbs [] = -{ - BONOBO_UI_UNSAFE_VERB ("WindowMenuHelp", window_menu_help), - BONOBO_UI_UNSAFE_VERB ("WindowMenuAbout", window_menu_about), - BONOBO_UI_VERB_END +static const GtkActionEntry window_menu_actions [] = { + { "WindowMenuHelp", GTK_STOCK_HELP, N_("_Help"), + NULL, NULL, + G_CALLBACK (window_menu_help) }, + { "WindowMenuAbout", GTK_STOCK_ABOUT, N_("_About"), + NULL, NULL, + G_CALLBACK (window_menu_about) }, }; static void @@ -231,8 +231,9 @@ gboolean window_menu_applet_fill (PanelApplet *applet) { - WindowMenu *window_menu; - WnckScreen *screen; + WindowMenu *window_menu; + WnckScreen *screen; + PanelAppletMenu *popup_menu; window_menu = g_new0 (WindowMenu, 1); @@ -247,8 +248,16 @@ g_signal_connect (window_menu->applet, "destroy", G_CALLBACK (window_menu_destroy), window_menu); - panel_applet_setup_menu_from_file (applet, NULL, "GNOME_WindowMenuApplet.xml", - NULL, window_menu_verbs, window_menu); + popup_menu = panel_applet_get_menu (PANEL_APPLET (window_menu->applet)); + + panel_applet_menu_add_actions (popup_menu, + window_menu_actions, + G_N_ELEMENTS (window_menu_actions), + window_menu); + panel_applet_menu_add_ui_from_file (popup_menu, + NULL, + "GNOME_WindowMenuApplet.xml", + NULL); screen = wncklet_get_screen (window_menu->applet); window_menu->selector = wnck_selector_new (screen); Index: applets/wncklet/wncklet.c =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/wncklet.c,v retrieving revision 1.8 diff -u -u -r1.8 wncklet.c --- applets/wncklet/wncklet.c 12 Jan 2006 15:18:01 -0000 1.8 +++ applets/wncklet/wncklet.c 27 Feb 2006 11:18:17 -0000 @@ -26,7 +26,6 @@ #endif #include -#include #include #include #include @@ -180,27 +179,27 @@ type_registered = TRUE; } - if (!strcmp (iid, "OAFIID:GNOME_WindowMenuApplet")) + if (!strcmp (iid, "WindowMenu")) retval = window_menu_applet_fill (applet); - else if (!strcmp (iid, "OAFIID:GNOME_WorkspaceSwitcherApplet")|| - !strcmp (iid, "OAFIID:GNOME_PagerApplet")) + else if (!strcmp (iid, "WorkspaceSwitcher")|| + !strcmp (iid, "PagerApplet")) retval = workspace_switcher_applet_fill (applet); - else if (!strcmp (iid, "OAFIID:GNOME_WindowListApplet") || - !strcmp (iid, "OAFIID:GNOME_TasklistApplet")) + else if (!strcmp (iid, "WindowList") || + !strcmp (iid, "TasklistApplet")) retval = window_list_applet_fill (applet); - else if (!strcmp (iid, "OAFIID:GNOME_ShowDesktopApplet")) + else if (!strcmp (iid, "ShowDesktop")) retval = show_desktop_applet_fill (applet); return retval; } +PANEL_APPLET_FACTORY_MAIN ("Wncklet", + PANEL_TYPE_APPLET, + "WindowNavigationApplets", + "0", + wncklet_factory, + NULL); -PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_Wncklet_Factory", - PANEL_TYPE_APPLET, - "WindowNavigationApplets", - "0", - wncklet_factory, - NULL); Index: applets/wncklet/wncklet.h =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/wncklet.h,v retrieving revision 1.3 diff -u -u -r1.3 wncklet.h --- applets/wncklet/wncklet.h 28 Dec 2005 21:18:36 -0000 1.3 +++ applets/wncklet/wncklet.h 27 Feb 2006 11:18:17 -0000 @@ -28,8 +28,11 @@ #include #include +#include #include + #include +#include G_BEGIN_DECLS Index: applets/wncklet/workspace-switcher.c =================================================================== RCS file: /cvs/gnome/gnome-panel/applets/wncklet/workspace-switcher.c,v retrieving revision 1.75 diff -u -u -r1.75 workspace-switcher.c --- applets/wncklet/workspace-switcher.c 28 Dec 2005 21:18:36 -0000 1.75 +++ applets/wncklet/workspace-switcher.c 27 Feb 2006 11:18:17 -0000 @@ -16,7 +16,6 @@ #include -#include #include #include @@ -68,15 +67,12 @@ guint listeners [3]; } PagerData; -static void display_properties_dialog (BonoboUIComponent *uic, - PagerData *pager, - const gchar *verbname); -static void display_help_dialog (BonoboUIComponent *uic, - PagerData *pager, - const gchar *verbname); -static void display_about_dialog (BonoboUIComponent *uic, - PagerData *pager, - const gchar *verbname); +static void display_properties_dialog (GtkAction *action, + PagerData *pager); +static void display_help_dialog (GtkAction *action, + PagerData *pager); +static void display_about_dialog (GtkAction *action, + PagerData *pager); static void pager_update (PagerData *pager) @@ -276,11 +272,16 @@ g_free (pager); } -static const BonoboUIVerb pager_menu_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("PagerPreferences", display_properties_dialog), - BONOBO_UI_UNSAFE_VERB ("PagerHelp", display_help_dialog), - BONOBO_UI_UNSAFE_VERB ("PagerAbout", display_about_dialog), - BONOBO_UI_VERB_END +static const GtkActionEntry pager_menu_actions [] = { + { "PagerPreferences", GTK_STOCK_PROPERTIES, N_("_Preferences"), + NULL, NULL, + G_CALLBACK (display_properties_dialog) }, + { "PagerHelp", GTK_STOCK_HELP, N_("_Help"), + NULL, NULL, + G_CALLBACK (display_help_dialog) }, + { "PagerAbout", GTK_STOCK_ABOUT, N_("_About"), + NULL, NULL, + G_CALLBACK (display_about_dialog) }, }; static void @@ -407,6 +408,7 @@ workspace_switcher_applet_fill (PanelApplet *applet) { PagerData *pager; + PanelAppletMenu *popup_menu; GError *error; gboolean display_names; @@ -503,44 +505,41 @@ G_CALLBACK (applet_change_background), pager); - panel_applet_set_background_widget (PANEL_APPLET (pager->applet), - GTK_WIDGET (pager->applet)); - - panel_applet_setup_menu_from_file (PANEL_APPLET (pager->applet), - NULL, - "GNOME_WorkspaceSwitcherApplet.xml", - NULL, - pager_menu_verbs, - pager); + panel_applet_set_background_widget (PANEL_APPLET (pager->applet), + GTK_WIDGET (pager->applet)); - if (panel_applet_get_locked_down (PANEL_APPLET (pager->applet))) { - BonoboUIComponent *popup_component; + popup_menu = panel_applet_get_menu (PANEL_APPLET (pager->applet)); - popup_component = panel_applet_get_popup_component (PANEL_APPLET (pager->applet)); + panel_applet_menu_add_actions (popup_menu, + pager_menu_actions, + G_N_ELEMENTS (pager_menu_actions), + pager); + panel_applet_menu_add_ui_from_file (popup_menu, + NULL, + "GNOME_WorkspaceSwitcherApplet.xml", + NULL); + + if (panel_applet_get_locked_down (PANEL_APPLET (pager->applet))) { + GtkAction *action; - bonobo_ui_component_set_prop (popup_component, - "/commands/PagerPreferences", - "hidden", "1", - NULL); + action = panel_applet_menu_get_action (popup_menu, "PagerPreferences"); + gtk_action_set_visible (action, FALSE); } return TRUE; } - static void -display_help_dialog (BonoboUIComponent *uic, - PagerData *pager, - const gchar *verbname) +display_help_dialog (GtkAction *action, + PagerData *pager) { wncklet_display_help (pager->applet, "workspace-switcher", "workspace-switcher", NULL); } static void -display_about_dialog (BonoboUIComponent *uic, - PagerData *pager, - const gchar *verbname) +display_about_dialog (GtkAction *action, + PagerData *pager) { static const gchar *authors[] = { @@ -912,10 +911,9 @@ } } -static void -display_properties_dialog (BonoboUIComponent *uic, - PagerData *pager, - const gchar *verbname) +static void +display_properties_dialog (GtkAction *action, + PagerData *pager) { if (pager->properties_dialog == NULL) { GladeXML *xml; Index: gnome-panel/GNOME_Panel_Popup.xml =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/GNOME_Panel_Popup.xml,v retrieving revision 1.7 diff -u -u -r1.7 GNOME_Panel_Popup.xml --- gnome-panel/GNOME_Panel_Popup.xml 22 Jan 2006 15:30:17 -0000 1.7 +++ gnome-panel/GNOME_Panel_Popup.xml 27 Feb 2006 11:18:17 -0000 @@ -1,20 +1,7 @@ - - - + + + + + + - - - - - - - - - - - - - - Index: gnome-panel/Makefile.am =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/Makefile.am,v retrieving revision 1.358 diff -u -u -r1.358 Makefile.am --- gnome-panel/Makefile.am 12 Feb 2006 19:07:03 -0000 1.358 +++ gnome-panel/Makefile.am 27 Feb 2006 11:18:17 -0000 @@ -6,6 +6,8 @@ INCLUDES = \ -I. \ -I$(srcdir) \ + -I$(srcdir)/../libpanel-applet \ + -I$(top_builddir)/libpanel-applet \ -I$(top_builddir)/gnome-panel \ -DPANEL_DEBUG \ -DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ @@ -33,16 +35,11 @@ $(gnome_panel_OBJECTS): $(BUILT_SOURCES) -CORBA_SRCLIST = \ - GNOME_Panel-stubs.c \ - GNOME_Panel-skels.c \ - GNOME_Panel-common.c \ - GNOME_Panel.h \ - $(NULL) - -$(CORBA_SRCLIST): $(top_srcdir)/idl/GNOME_Panel.idl $(ORBIT_IDL) - $(ORBIT_IDL) -I $(BONOBO_IDLDIR) -I $(BONOBO_ACT_IDLDIR) $(top_srcdir)/idl/GNOME_Panel.idl +DBUS_SRCLIST = panel-shell-glue.h +panel-shell-glue.h: panel-shell.xml + dbus-binding-tool --prefix=panel_shell --mode=glib-server --output=$@ $^ + EGG_RECENT_FILES_C = \ egg-recent-model.c \ egg-recent-item.c \ @@ -63,7 +60,7 @@ $(NULL) BUILT_SOURCES = \ - $(CORBA_SRCLIST) \ + $(DBUS_SRCLIST) \ panel-typebuiltins.c \ panel-typebuiltins.h \ panel-marshal.c \ @@ -168,13 +165,14 @@ $(NULL) gnome_panel_SOURCES = \ - $(CORBA_SRCLIST) \ + $(DBUS_SRCLIST) \ $(EGG_ACCELERATORS_FILES) \ $(panel_sources) \ $(panel_headers) \ $(NULL) gnome_panel_LDADD = \ + ../libpanel-applet/libpanel-applet-2.la \ $(PANEL_LIBS) \ $(X_LIBS) @@ -190,6 +188,7 @@ gnome_desktop_item_edit_LDFLAGS = -export-dynamic gnome_desktop_item_edit_LDADD = \ + ../libpanel-applet/libpanel-applet-2.la \ $(PANEL_LIBS) \ $(X_LIBS) @@ -199,7 +198,6 @@ panel-run-dialog.glade EXTRA_DIST = \ - GNOME_Panel.server.in \ $(glade_DATA) \ nothing.cP \ nothing.h \ @@ -209,14 +207,14 @@ panel-marshal.list \ update-from-egg.sh \ gnome-panelrc \ + panel-shell.xml \ $(entries_DATA) @INTLTOOL_DESKTOP_RULE@ panel_enum_headers = \ $(top_srcdir)/gnome-panel/panel-enums.h \ - $(top_srcdir)/gnome-panel/panel-types.h \ - GNOME_Panel.h + $(top_srcdir)/gnome-panel/panel-types.h panel-marshal.h: panel-marshal.list $(GLIB_GENMARSHAL) $(GLIB_GENMARSHAL) $< --header --prefix=panel_marshal > $@ @@ -253,10 +251,6 @@ uidir = $(datadir)/gnome-2.0/ui ui_DATA = GNOME_Panel_Popup.xml - -serverdir = $(libdir)/bonobo/servers -server_in_files = GNOME_Panel.server.in -server_DATA = $(server_in_files:.server.in=.server) rcdir = $(datadir) rc_DATA = gnome-panelrc Index: gnome-panel/applet.c =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/applet.c,v retrieving revision 1.253 diff -u -u -r1.253 applet.c --- gnome-panel/applet.c 22 Jan 2006 15:01:30 -0000 1.253 +++ gnome-panel/applet.c 27 Feb 2006 11:18:18 -0000 @@ -56,7 +56,7 @@ case PANEL_OBJECT_LAUNCHER: panel_launcher_set_dnd_enabled (info->data, dnd_enabled); break; - case PANEL_OBJECT_BONOBO: + case PANEL_OBJECT_APPLET: break; case PANEL_OBJECT_LOGOUT: case PANEL_OBJECT_LOCK: @@ -71,7 +71,6 @@ g_assert_not_reached (); break; } - } gboolean @@ -193,7 +192,7 @@ panel_applet_toggle_locked (info); - if (info->type == PANEL_OBJECT_BONOBO) + if (info->type == PANEL_OBJECT_APPLET) panel_applet_frame_sync_menu_state (PANEL_APPLET_FRAME (info->widget)); else panel_applet_recreate_menu (info); @@ -266,7 +265,7 @@ PANEL_MENU_BAR (menu->info->widget), menu->name); break; - case PANEL_OBJECT_BONOBO: + case PANEL_OBJECT_APPLET: /* * Applet's menu's are handled differently */ @@ -677,7 +676,7 @@ if (panel_applet_is_in_drag ()) return FALSE; - if (info->type == PANEL_OBJECT_BONOBO) + if (info->type == PANEL_OBJECT_APPLET) return FALSE; applet_show_menu (info, event); @@ -738,7 +737,7 @@ } } - if (info->type != PANEL_OBJECT_BONOBO) + if (info->type != PANEL_OBJECT_APPLET) panel_lockdown_notify_remove (G_CALLBACK (panel_applet_recreate_menu), info); @@ -848,7 +847,7 @@ } switch (applet->type) { - case PANEL_OBJECT_BONOBO: + case PANEL_OBJECT_APPLET: panel_applet_frame_load_from_gconf ( panel_widget, applet->locked, @@ -1040,7 +1039,7 @@ client = panel_gconf_get_client (); - key_type = applet_info->type == PANEL_OBJECT_BONOBO ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS; + key_type = applet_info->type == PANEL_OBJECT_APPLET ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS; panel_widget = PANEL_WIDGET (applet_info->widget->parent); @@ -1182,11 +1181,11 @@ g_object_set_data (G_OBJECT (applet), "applet_info", info); - if (type != PANEL_OBJECT_BONOBO) + if (type != PANEL_OBJECT_APPLET) panel_lockdown_notify_add (G_CALLBACK (panel_applet_recreate_menu), info); - key = panel_gconf_full_key ((type == PANEL_OBJECT_BONOBO) ? + key = panel_gconf_full_key ((type == PANEL_OBJECT_APPLET) ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS, id, "locked"); panel_gconf_notify_add_while_alive (key, @@ -1252,7 +1251,7 @@ size_change (info, panel); back_change (info, panel); - if (type != PANEL_OBJECT_BONOBO) + if (type != PANEL_OBJECT_APPLET) gtk_widget_grab_focus (applet); else gtk_widget_child_focus (applet, GTK_DIR_TAB_FORWARD); @@ -1285,7 +1284,7 @@ client = panel_gconf_get_client (); - key_type = (applet->type == PANEL_OBJECT_BONOBO) ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS; + key_type = (applet->type == PANEL_OBJECT_APPLET) ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS; key = panel_gconf_full_key (key_type, applet->id, "position"); if (!gconf_client_key_is_writable (client, key, NULL)) @@ -1314,7 +1313,7 @@ client = panel_gconf_get_client (); - key_type = (applet->type == PANEL_OBJECT_BONOBO) ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS; + key_type = (applet->type == PANEL_OBJECT_APPLET) ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS; key = panel_gconf_full_key (key_type, applet->id, "locked"); Index: gnome-panel/panel-addto.c =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-addto.c,v retrieving revision 1.45 diff -u -u -r1.45 panel-addto.c --- gnome-panel/panel-addto.c 22 Jan 2006 15:01:31 -0000 1.45 +++ gnome-panel/panel-addto.c 27 Feb 2006 11:18:18 -0000 @@ -25,7 +25,9 @@ #include #include -#include +#include + +#include #include "menu.h" @@ -177,16 +179,6 @@ TRUE } }; -static const char applet_requirements [] = - "has_all (repo_ids, ['IDL:Bonobo/Control:1.0'," - " 'IDL:GNOME/Vertigo/PanelAppletShell:1.0']) && " - "defined (panel:icon)"; - -static char *applet_sort_criteria [] = { - "name", - NULL - }; - enum { COLUMN_ICON, COLUMN_TEXT, @@ -210,7 +202,8 @@ panel_addto_applet_info_sort_func (PanelAddtoItemInfo *a, PanelAddtoItemInfo *b) { - return g_utf8_collate (a->name, b->name); + return (a->name && b->name) ? + g_utf8_collate (a->name, b->name) : 0; } static GSList * @@ -386,72 +379,39 @@ static GSList * panel_addto_query_applets (GSList *list) { - Bonobo_ServerInfoList *applet_list; - CORBA_Environment env; - const char * const *langs; - GSList *langs_gslist; - int i; - - CORBA_exception_init (&env); - - applet_list = bonobo_activation_query (applet_requirements, - applet_sort_criteria, - &env); - if (BONOBO_EX (&env)) { - g_warning (_("query returned exception %s\n"), - BONOBO_EX_REPOID (&env)); - - CORBA_exception_free (&env); - CORBA_free (applet_list); - - return NULL; - } - - CORBA_exception_free (&env); + PanelAppletManager *manager; + GList *applet_list = NULL; + GList *l; - langs = g_get_language_names (); - - langs_gslist = NULL; - for (i = 0; langs[i]; i++) - langs_gslist = g_slist_prepend (langs_gslist, (char *) langs[i]); - - langs_gslist = g_slist_reverse (langs_gslist); - - for (i = 0; i < applet_list->_length; i++) { - Bonobo_ServerInfo *info; - const char *name, *description, *icon; + manager = panel_applet_manager_new (); + applet_list = panel_applet_manager_get_applets (manager); + + for (l = applet_list; l && l->data; l = g_list_next (l)) { + PanelAppletInfo *info; PanelAddtoItemInfo *applet; - info = &applet_list->_buffer[i]; - - name = bonobo_server_info_prop_lookup (info, - "name", - langs_gslist); - description = bonobo_server_info_prop_lookup (info, - "description", - langs_gslist); - icon = bonobo_server_info_prop_lookup (info, - "panel:icon", - NULL); + info = (PanelAppletInfo *) l->data; - if (!name || - panel_lockdown_is_applet_disabled (info->iid)) { + if (!info->id || + panel_lockdown_is_applet_disabled (info->id)) { continue; } applet = g_new0 (PanelAddtoItemInfo, 1); applet->type = PANEL_ADDTO_APPLET; - applet->name = g_strdup (name); - applet->description = g_strdup (description); - applet->icon = g_strdup (icon); - applet->iid = g_strdup (info->iid); + applet->name = g_strdup (info->name); + applet->description = g_strdup (info->comment); + applet->icon = g_strdup (info->icon); + applet->iid = g_strdup (info->id); applet->static_data = FALSE; list = g_slist_prepend (list, applet); + + panel_applet_info_free (info); } - g_slist_free (langs_gslist); - CORBA_free (applet_list); + g_list_free (applet_list); + g_object_unref (manager); return list; } Index: gnome-panel/panel-applet-frame.c =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-applet-frame.c,v retrieving revision 1.144 diff -u -u -r1.144 panel-applet-frame.c --- gnome-panel/panel-applet-frame.c 22 Jan 2006 15:30:17 -0000 1.144 +++ gnome-panel/panel-applet-frame.c 27 Feb 2006 11:18:18 -0000 @@ -26,11 +26,13 @@ #include #include -#include +#include #include #include #include +#include + #include "panel-applet-frame.h" #include "panel-profile.h" #include "panel-util.h" @@ -45,44 +47,20 @@ #undef PANEL_APPLET_FRAME_DEBUG -#define HANDLE_SIZE 10 - -#define PROPERTY_ORIENT "panel-applet-orient" -#define PROPERTY_SIZE "panel-applet-size" -#define PROPERTY_BACKGROUND "panel-applet-background" -#define PROPERTY_FLAGS "panel-applet-flags" -#define PROPERTY_SIZE_HINTS "panel-applet-size-hints" -#define PROPERTY_LOCKED_DOWN "panel-applet-locked-down" - - struct _PanelAppletFramePrivate { - GNOME_Vertigo_PanelAppletShell applet_shell; - CORBA_Object control; - Bonobo_PropertyBag property_bag; - BonoboUIComponent *ui_component; - - PanelWidget *panel; - AppletInfo *applet_info; - PanelOrientation orientation; - - gchar *iid; - gboolean moving_focus_out; - - GtkAllocation child_allocation; - GdkRectangle handle_rect; - - guint has_handle : 1; + PanelWidget *panel; + AppletInfo *applet_info; + gchar *iid; }; typedef struct { - PanelAppletFrame *frame; - gboolean locked; - int position; - gboolean exactpos; - char *id; + gboolean locked; + gint position; + gboolean exactpos; + gchar *id; } PanelAppletFrameActivating; -static GObjectClass *parent_class; +static PanelAppletContainerClass *parent_class; /* Keep in sync with panel-applet.h. Uggh. */ @@ -93,17 +71,17 @@ APPLET_HAS_HANDLE = 1 << 2 } PanelAppletFlags; -static void panel_applet_frame_cnx_broken (ORBitConnection *cnx, - PanelAppletFrame *frame); +#define HANDLE_SIZE 10 + +static void panel_applet_frame_cnx_broken (PanelAppletContainer *container); -static char *panel_applet_frame_construct_moniker (PanelAppletFrame *frame, - PanelWidget *panel, - const char *iid, - const char *id); - -static void panel_applet_frame_activated (Bonobo_Unknown object, - CORBA_Environment *ev, - gpointer *data); +static gboolean panel_applet_frame_activated (PanelAppletContainer *container, + GError *error, + gpointer user_data); + +static char *panel_applet_frame_get_background_string (PanelAppletFrame *frame, + PanelWidget *panel, + PanelBackgroundType type); void panel_applet_frame_sync_menu_state (PanelAppletFrame *frame) @@ -114,6 +92,7 @@ gboolean lockable; gboolean movable; gboolean removable; + GValue value = {0, }; panel_widget = PANEL_WIDGET (GTK_WIDGET (frame)->parent); @@ -123,133 +102,146 @@ locked = panel_widget_get_applet_locked (panel_widget, GTK_WIDGET (frame)); - bonobo_ui_component_set_prop (frame->priv->ui_component, - "/commands/LockAppletToPanel", - "state", - locked ? "1" : "0", - NULL); - + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, locked); + panel_applet_container_menu_set_property (PANEL_APPLET_CONTAINER (frame), + "Lock", "active", &value); + g_value_unset (&value); + /* First sensitivity */ - bonobo_ui_component_set_prop (frame->priv->ui_component, - "/commands/LockAppletToPanel", - "sensitive", - lockable ? "1" : "0", - NULL); - - bonobo_ui_component_set_prop (frame->priv->ui_component, - "/commands/RemoveAppletFromPanel", - "sensitive", - (locked && !lockable) ? "0" : (removable ? "1" : "0"), - NULL); - - bonobo_ui_component_set_prop (frame->priv->ui_component, - "/commands/MoveApplet", - "sensitive", - locked ? "0" : (movable ? "1" : "0"), - NULL); - + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, lockable); + panel_applet_container_menu_set_property (PANEL_APPLET_CONTAINER (frame), + "Lock", "sensitive", &value); + g_value_unset (&value); + + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, (locked && !lockable) ? FALSE : removable); + panel_applet_container_menu_set_property (PANEL_APPLET_CONTAINER (frame), + "Remove", "sensitive", &value); + g_value_unset (&value); + + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, locked ? FALSE : movable); + panel_applet_container_menu_set_property (PANEL_APPLET_CONTAINER (frame), + "Move", "sensitive", &value); + g_value_unset (&value); + /* Second visibility */ locked_down = panel_lockdown_get_locked_down (); - bonobo_ui_component_set_prop (frame->priv->ui_component, - "/commands/LockAppletToPanel", - "hidden", - locked_down ? "1" : "0", - NULL); - - bonobo_ui_component_set_prop (frame->priv->ui_component, - "/commands/LockSeparator", - "hidden", - locked_down ? "1" : "0", - NULL); - - bonobo_ui_component_set_prop (frame->priv->ui_component, - "/commands/RemoveAppletFromPanel", - "hidden", - locked_down ? "1" : "0", - NULL); - - bonobo_ui_component_set_prop (frame->priv->ui_component, - "/commands/MoveApplet", - "hidden", - locked_down ? "1" : "0", - NULL); + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, !locked_down); + panel_applet_container_menu_set_property (PANEL_APPLET_CONTAINER (frame), + "Lock", "visible", &value); + panel_applet_container_menu_set_property (PANEL_APPLET_CONTAINER (frame), + "Remove", "visible", &value); + panel_applet_container_menu_set_property (PANEL_APPLET_CONTAINER (frame), + "Move", "visible", &value); + g_value_unset (&value); } static void -panel_applet_frame_set_flags_from_any (PanelAppletFrame *frame, - const CORBA_any *any) +panel_applet_frame_set_flags (PanelAppletFrame *frame, + guint flags) { gboolean major; gboolean minor; - int flags; - flags = BONOBO_ARG_GET_SHORT (any); - major = flags & APPLET_EXPAND_MAJOR; minor = flags & APPLET_EXPAND_MINOR; panel_widget_set_applet_expandable ( frame->priv->panel, GTK_WIDGET (frame), major, minor); - - frame->priv->has_handle = (flags & APPLET_HAS_HANDLE) != 0; + + g_object_set (G_OBJECT (frame), "has-handle", + (flags & APPLET_HAS_HANDLE) != 0, + NULL); } static void -panel_applet_frame_set_size_hints_from_any (PanelAppletFrame *frame, - const CORBA_any *any) +panel_applet_frame_set_size_hints (PanelAppletFrame *frame, + GValueArray *size_hints) { - CORBA_sequence_CORBA_long *seq; - int *size_hints; + int *hints; int extra_size; int i; + gboolean has_handle; - seq = any->_value; - - size_hints = g_new0 (int, seq->_length); - + if (g_value_get_int (g_value_array_get_nth (size_hints, 0)) == -1) + return; + + g_object_get (G_OBJECT (frame), "has-handle", &has_handle, NULL); + + hints = g_new0 (int, size_hints->n_values); + extra_size = 0; - if (frame->priv->has_handle) + if (has_handle) extra_size = HANDLE_SIZE + 1; - - for (i = 0; i < seq->_length; i++) - size_hints [i] = seq->_buffer [i] + extra_size; + + for (i = 0; i < size_hints->n_values; i++) { + hints[i] = g_value_get_int (g_value_array_get_nth (size_hints, i)) + extra_size; + } panel_widget_set_applet_size_hints (frame->priv->panel, GTK_WIDGET (frame), - size_hints, - seq->_length); + hints, + size_hints->n_values); +} + +static void +panel_applet_frame_flags_changed (PanelAppletFrame *frame, + const GValue *value, + gpointer user_data) +{ + guint flags; + + flags = g_value_get_uint (value); + panel_applet_frame_set_flags (frame, flags); +} + +static void +panel_applet_frame_size_hints_changed (PanelAppletFrame *frame, + const GValue *value, + gpointer user_data) +{ + GValueArray *size_hints; + + size_hints = g_value_get_boxed (value); + + panel_applet_frame_set_size_hints (frame, size_hints); } static void panel_applet_frame_init_properties (PanelAppletFrame *frame) { - CORBA_any *any; + guint flags; + GValueArray *size_hints; - any = bonobo_pbclient_get_value (frame->priv->property_bag, - PROPERTY_FLAGS, - BONOBO_ARG_SHORT, - NULL); - if (any) { - panel_applet_frame_set_flags_from_any (frame, any); - CORBA_free (any); - } - - any = bonobo_pbclient_get_value (frame->priv->property_bag, - PROPERTY_SIZE_HINTS, - TC_CORBA_sequence_CORBA_long, - NULL); - if (any) { - panel_applet_frame_set_size_hints_from_any (frame, any); - CORBA_free (any); - } + panel_applet_container_child_get (PANEL_APPLET_CONTAINER (frame), + "flags", &flags, + "size-hints", &size_hints, + NULL); + + panel_applet_frame_set_flags (frame, flags); + panel_applet_frame_set_size_hints (frame, size_hints); + + g_value_array_free (size_hints); + + panel_applet_container_child_notify_add (PANEL_APPLET_CONTAINER (frame), + "flags", + G_CALLBACK (panel_applet_frame_flags_changed), + NULL); + panel_applet_container_child_notify_add (PANEL_APPLET_CONTAINER (frame), + "size-hints", + G_CALLBACK (panel_applet_frame_size_hints_changed), + NULL); } static void -popup_handle_remove (BonoboUIComponent *uic, - PanelAppletFrame *frame, - const gchar *verbname) +popup_handle_remove (GtkAction *action, gpointer user_data) { + PanelAppletFrame *frame = PANEL_APPLET_FRAME (user_data); AppletInfo *info; info = frame->priv->applet_info; @@ -259,59 +251,48 @@ } static void -listener_popup_handle_lock (BonoboUIComponent *uic, - const char *path, - Bonobo_UIComponent_EventType type, - const char *state, - gpointer data) +popup_handle_lock (GtkAction *action, gpointer user_data) { - PanelAppletFrame *frame; + PanelAppletFrame *frame = PANEL_APPLET_FRAME (user_data); AppletInfo *info; - gboolean s; - - g_assert (!strcmp (path, "LockAppletToPanel")); - - if (type != Bonobo_UIComponent_STATE_CHANGED) - return; - - if (!state) - return; + gboolean locked; - frame = (PanelAppletFrame *) data; info = frame->priv->applet_info; - s = (strcmp (state, "1") == 0); - + locked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + if (panel_widget_get_applet_locked (PANEL_WIDGET (info->widget->parent), - info->widget) == s) + info->widget) == locked) return; - + panel_applet_toggle_locked (frame->priv->applet_info); panel_applet_frame_sync_menu_state (frame); } static void -popup_handle_move (BonoboUIComponent *uic, - PanelAppletFrame *frame, - const gchar *verbname) +popup_handle_move (GtkAction *action, gpointer user_data) { - GtkWidget *widget; - - g_return_if_fail (GTK_IS_WIDGET (frame)); + GtkWidget *widget = GTK_WIDGET (user_data); - widget = GTK_WIDGET (frame); - g_return_if_fail (PANEL_IS_WIDGET (widget->parent)); panel_widget_applet_drag_start ( PANEL_WIDGET (widget->parent), widget, PW_DRAG_OFF_CENTER, GDK_CURRENT_TIME); } -static BonoboUIVerb popup_verbs [] = { - BONOBO_UI_UNSAFE_VERB ("RemoveAppletFromPanel", popup_handle_remove), - BONOBO_UI_UNSAFE_VERB ("MoveApplet", popup_handle_move), +static const GtkActionEntry popup_actions[] = { + { "Remove", GTK_STOCK_REMOVE, N_("_Remove From Panel"), + NULL, NULL, + G_CALLBACK (popup_handle_remove) }, + { "Move", NULL, N_("_Move"), + NULL, NULL, + G_CALLBACK (popup_handle_move) }, +}; - BONOBO_UI_VERB_END +static const GtkToggleActionEntry popup_toggle_actions[] = { + { "Lock", NULL, N_("_Lock To Panel"), + NULL, NULL, + G_CALLBACK (popup_handle_lock), FALSE }, }; static void @@ -322,10 +303,11 @@ gboolean exactpos, const char *id) { - PanelAppletFrame *frame; - CORBA_Environment ev; - char *moniker; PanelAppletFrameActivating *frame_act; + PanelAppletFrame *frame; + gchar *prefs_key; + gchar *background; + guint orient, size; g_return_if_fail (iid != NULL); g_return_if_fail (panel != NULL); @@ -339,21 +321,29 @@ frame->priv->iid = g_strdup (iid); frame_act = g_new (PanelAppletFrameActivating, 1); - frame_act->frame = frame; frame_act->locked = locked; frame_act->position = position; frame_act->exactpos = exactpos; frame_act->id = g_strdup (id); - moniker = panel_applet_frame_construct_moniker (frame, panel, iid, id); - - CORBA_exception_init (&ev); - - bonobo_get_object_async (moniker, "IDL:Bonobo/Control:1.0", &ev, - (BonoboMonikerAsyncFn) panel_applet_frame_activated, - frame_act); - - g_free (moniker); + prefs_key = g_strdup_printf ("/apps/panel/applets/%s/prefs", id); + background = panel_applet_frame_get_background_string (frame, + panel, + panel->background.type); + orient = panel_widget_get_applet_orientation (panel); + size = panel->sz; + + panel_applet_container_add_with_properties (PANEL_APPLET_CONTAINER (frame), iid, + (PanelAppletActivateCb)panel_applet_frame_activated, + frame_act, + "prefs-key", prefs_key, + "background", background, + "orient", orient, + "size", size, + "locked-down", locked, + NULL); + g_free (prefs_key); + g_free (background); } void @@ -363,22 +353,26 @@ const char *id) { const char *key; - char *applet_iid; + char *applet_id; g_return_if_fail (panel_widget != NULL); g_return_if_fail (id != NULL); - key = panel_gconf_full_key (PANEL_GCONF_APPLETS, id, "bonobo_iid"); - applet_iid = gconf_client_get_string (panel_gconf_get_client (), - key, NULL); + key = panel_gconf_full_key (PANEL_GCONF_APPLETS, id, "applet_id"); + applet_id = gconf_client_get_string (panel_gconf_get_client (), key, NULL); - if (!applet_iid) + if (!applet_id) { + /* Compatibility */ + key = panel_gconf_full_key (PANEL_GCONF_APPLETS, id, "bonobo_iid"); + applet_id = gconf_client_get_string (panel_gconf_get_client (), key, NULL); + } + + if (!applet_id) return; - panel_applet_frame_load (applet_iid, panel_widget, - locked, position, TRUE, id); + panel_applet_frame_load (applet_id, panel_widget, locked, position, TRUE, id); - g_free (applet_iid); + g_free (applet_id); } void @@ -394,9 +388,9 @@ client = panel_gconf_get_client (); - id = panel_profile_prepare_object (PANEL_OBJECT_BONOBO, toplevel, position, FALSE); + id = panel_profile_prepare_object (PANEL_OBJECT_APPLET, toplevel, position, FALSE); - key = panel_gconf_full_key (PANEL_GCONF_APPLETS, id, "bonobo_iid"); + key = panel_gconf_full_key (PANEL_GCONF_APPLETS, id, "applet_id"); gconf_client_set_string (client, key, iid, NULL); panel_profile_add_to_list (PANEL_GCONF_APPLETS, id); @@ -408,57 +402,54 @@ panel_applet_frame_change_orientation (PanelAppletFrame *frame, PanelOrientation orientation) { - CORBA_unsigned_short orient = 0; - - if (orientation == frame->priv->orientation) - return; + GtkOrientation orient; + gboolean changed = TRUE; - frame->priv->orientation = orientation; + g_object_get (G_OBJECT (frame), "orient", &orient, NULL); switch (orientation) { case PANEL_ORIENTATION_TOP: - orient = GNOME_Vertigo_PANEL_ORIENT_DOWN; - break; case PANEL_ORIENTATION_BOTTOM: - orient = GNOME_Vertigo_PANEL_ORIENT_UP; + if (orient == GTK_ORIENTATION_HORIZONTAL) + changed = FALSE; + orient = GTK_ORIENTATION_HORIZONTAL; break; case PANEL_ORIENTATION_LEFT: - orient = GNOME_Vertigo_PANEL_ORIENT_RIGHT; - break; case PANEL_ORIENTATION_RIGHT: - orient = GNOME_Vertigo_PANEL_ORIENT_LEFT; + if (orient == GTK_ORIENTATION_VERTICAL) + changed = FALSE; + orient = GTK_ORIENTATION_VERTICAL; break; default: g_assert_not_reached (); break; } - bonobo_pbclient_set_short (frame->priv->property_bag, - PROPERTY_ORIENT, - orient, - NULL); - + if (changed) + g_object_set (G_OBJECT (frame), "orient", orient, NULL); + + panel_applet_container_child_set (PANEL_APPLET_CONTAINER (frame), + "orient", orientation, NULL); + gtk_widget_queue_resize (GTK_WIDGET (frame)); } void panel_applet_frame_change_size (PanelAppletFrame *frame, - PanelSize size) + gint size) { /* Normalise the size to the constants defined in * the IDL. */ - size = size <= PANEL_SIZE_XX_SMALL ? PANEL_SIZE_XX_SMALL : +/* size = size <= PANEL_SIZE_XX_SMALL ? PANEL_SIZE_XX_SMALL : size <= PANEL_SIZE_X_SMALL ? PANEL_SIZE_X_SMALL : size <= PANEL_SIZE_SMALL ? PANEL_SIZE_SMALL : size <= PANEL_SIZE_MEDIUM ? PANEL_SIZE_MEDIUM : size <= PANEL_SIZE_LARGE ? PANEL_SIZE_LARGE : - size <= PANEL_SIZE_X_LARGE ? PANEL_SIZE_X_LARGE : PANEL_SIZE_XX_LARGE; - - bonobo_pbclient_set_short (frame->priv->property_bag, - PROPERTY_SIZE, - size, - NULL); + size <= PANEL_SIZE_X_LARGE ? PANEL_SIZE_X_LARGE : PANEL_SIZE_XX_LARGE;*/ + + panel_applet_container_child_set (PANEL_APPLET_CONTAINER (frame), + "size", size, NULL); } static char * @@ -466,23 +457,30 @@ PanelWidget *panel, PanelBackgroundType type) { - int x; - int y; + int x; + int y; + gboolean has_handle; + PanelOrientation orient; + GdkRectangle handle_rect; x = GTK_WIDGET (frame)->allocation.x; y = GTK_WIDGET (frame)->allocation.y; - if (frame->priv->has_handle) { - switch (frame->priv->orientation) { - case PANEL_ORIENTATION_TOP: - case PANEL_ORIENTATION_BOTTOM: + g_object_get (G_OBJECT (frame), + "has-handle", &has_handle, + "handle-rect", &handle_rect, + "orient", &orient, + NULL); + + if (has_handle) { + switch (orient) { + case GTK_ORIENTATION_HORIZONTAL: if (gtk_widget_get_direction (GTK_WIDGET (frame)) != GTK_TEXT_DIR_RTL) - x += frame->priv->handle_rect.width; + x += handle_rect.width; break; - case PANEL_ORIENTATION_LEFT: - case PANEL_ORIENTATION_RIGHT: - y += frame->priv->handle_rect.height; + case GTK_ORIENTATION_VERTICAL: + y += handle_rect.height; break; default: g_assert_not_reached (); @@ -497,12 +495,17 @@ panel_applet_frame_change_background (PanelAppletFrame *frame, PanelBackgroundType type) { - char *bg_str; + char *bg_str; + gboolean has_handle; g_return_if_fail (PANEL_IS_APPLET_FRAME (frame)); g_return_if_fail (PANEL_IS_WIDGET (GTK_WIDGET (frame)->parent)); - if (frame->priv->has_handle) { + g_object_get (G_OBJECT (frame), + "has-handle", &has_handle, + NULL); + + if (has_handle) { PanelBackground *background; background = &PANEL_WIDGET (GTK_WIDGET (frame)->parent)->background; @@ -513,101 +516,26 @@ bg_str = panel_applet_frame_get_background_string ( frame, PANEL_WIDGET (GTK_WIDGET (frame)->parent), type); - if (bg_str != NULL) { - bonobo_pbclient_set_string (frame->priv->property_bag, - PROPERTY_BACKGROUND, - bg_str, NULL); - + if (bg_str) { + panel_applet_container_child_set (PANEL_APPLET_CONTAINER (frame), + "background", bg_str, NULL); g_free (bg_str); } } static void -panel_applet_frame_finalize (GObject *object) +panel_applet_frame_dispose (GObject *object) { PanelAppletFrame *frame = PANEL_APPLET_FRAME (object); panel_lockdown_notify_remove (G_CALLBACK (panel_applet_frame_sync_menu_state), frame); - if (frame->priv->property_bag) - bonobo_object_release_unref ( - frame->priv->property_bag, NULL); - - if (frame->priv->applet_shell) - bonobo_object_release_unref ( - frame->priv->applet_shell, NULL); - - if (frame->priv->ui_component) - bonobo_object_unref ( - BONOBO_OBJECT (frame->priv->ui_component)); - - if (frame->priv->control) { - ORBit_small_unlisten_for_broken (frame->priv->control, - G_CALLBACK (panel_applet_frame_cnx_broken)); - CORBA_Object_release (frame->priv->control, NULL); - frame->priv->control = CORBA_OBJECT_NIL; - } - g_free (frame->priv->iid); frame->priv->iid = NULL; - parent_class->finalize (object); -} - -static void -panel_applet_frame_paint (GtkWidget *widget, - GdkRectangle *area) -{ - PanelAppletFrame *frame; - - frame = PANEL_APPLET_FRAME (widget); - - if (!frame->priv->has_handle) - return; - - if (GTK_WIDGET_DRAWABLE (widget)) { - GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL; - - switch (frame->priv->orientation) { - case PANEL_ORIENTATION_TOP: - case PANEL_ORIENTATION_BOTTOM: - orientation = GTK_ORIENTATION_HORIZONTAL; - break; - case PANEL_ORIENTATION_LEFT: - case PANEL_ORIENTATION_RIGHT: - orientation = GTK_ORIENTATION_VERTICAL; - break; - default: - g_assert_not_reached (); - break; - } - - gtk_paint_handle ( - widget->style, widget->window, - GTK_WIDGET_STATE (widget), - GTK_SHADOW_OUT, - area, widget, "handlebox", - frame->priv->handle_rect.x, - frame->priv->handle_rect.y, - frame->priv->handle_rect.width, - frame->priv->handle_rect.height, - orientation); - } -} - -static gboolean -panel_applet_frame_expose (GtkWidget *widget, - GdkEventExpose *event) -{ - if (GTK_WIDGET_DRAWABLE (widget)) { - GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); - - panel_applet_frame_paint (widget, &event->area); - - } - - return FALSE; + if (G_OBJECT_CLASS (parent_class)->dispose) + (* G_OBJECT_CLASS (parent_class)->dispose) (object); } static void @@ -633,56 +561,10 @@ } static void -panel_applet_frame_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - PanelAppletFrame *frame; - GtkBin *bin; - GtkRequisition child_requisition; - - frame = PANEL_APPLET_FRAME (widget); - bin = GTK_BIN (widget); - - if (!frame->priv->has_handle) { - GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); - return; - } - - requisition->width = 0; - requisition->height = 0; - - if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { - gtk_widget_size_request (bin->child, &child_requisition); - - requisition->width = child_requisition.width; - requisition->height = child_requisition.height; - } - - requisition->width += GTK_CONTAINER (widget)->border_width; - requisition->height += GTK_CONTAINER (widget)->border_width; - - switch (frame->priv->orientation) { - case PANEL_ORIENTATION_TOP: - case PANEL_ORIENTATION_BOTTOM: - requisition->width += HANDLE_SIZE; - break; - case PANEL_ORIENTATION_LEFT: - case PANEL_ORIENTATION_RIGHT: - requisition->height += HANDLE_SIZE; - break; - default: - g_assert_not_reached (); - break; - } -} - -static void panel_applet_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { PanelAppletFrame *frame; - GtkBin *bin; - GtkAllocation new_allocation; GtkAllocation old_allocation; old_allocation.x = widget->allocation.x; @@ -691,82 +573,9 @@ old_allocation.height = widget->allocation.height; frame = PANEL_APPLET_FRAME (widget); - bin = GTK_BIN (widget); - - if (!frame->priv->has_handle) { - GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, - allocation); - panel_applet_frame_update_background_size (frame, - &old_allocation, - allocation); - return; - } - - widget->allocation = *allocation; - - frame->priv->handle_rect.x = 0; - frame->priv->handle_rect.y = 0; - - switch (frame->priv->orientation) { - case PANEL_ORIENTATION_TOP: - case PANEL_ORIENTATION_BOTTOM: - frame->priv->handle_rect.width = HANDLE_SIZE; - frame->priv->handle_rect.height = allocation->height; - - if (gtk_widget_get_direction (GTK_WIDGET (frame)) != - GTK_TEXT_DIR_RTL) { - frame->priv->handle_rect.x = 0; - new_allocation.x = HANDLE_SIZE; - } else { - frame->priv->handle_rect.x = allocation->width - HANDLE_SIZE; - new_allocation.x = 0; - } - - new_allocation.y = 0; - new_allocation.width = allocation->width - HANDLE_SIZE; - new_allocation.height = allocation->height; - break; - case PANEL_ORIENTATION_LEFT: - case PANEL_ORIENTATION_RIGHT: - frame->priv->handle_rect.width = allocation->width; - frame->priv->handle_rect.height = HANDLE_SIZE; - - new_allocation.x = 0; - new_allocation.y = HANDLE_SIZE; - new_allocation.width = allocation->width; - new_allocation.height = allocation->height - HANDLE_SIZE; - break; - default: - g_assert_not_reached (); - break; - } - - new_allocation.width = MAX (1, new_allocation.width); - new_allocation.height = MAX (1, new_allocation.height); - - /* If the child allocation changed, that means that the frame is drawn - * in a new place, so we must redraw the entire widget. - */ - if (GTK_WIDGET_MAPPED (widget) && - (new_allocation.x != frame->priv->child_allocation.x || - new_allocation.y != frame->priv->child_allocation.y || - new_allocation.width != frame->priv->child_allocation.width || - new_allocation.height != frame->priv->child_allocation.height)) - gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE); - - if (GTK_WIDGET_REALIZED (widget)) { - gdk_window_move_resize (widget->window, - allocation->x + GTK_CONTAINER (widget)->border_width, - allocation->y + GTK_CONTAINER (widget)->border_width, - MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0), - MAX (allocation->height - GTK_CONTAINER (widget)->border_width * 2, 0)); - } - - if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) - gtk_widget_size_allocate (bin->child, &new_allocation); - - frame->priv->child_allocation = new_allocation; - + + GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, + allocation); panel_applet_frame_update_background_size (frame, &old_allocation, allocation); @@ -791,10 +600,17 @@ { PanelAppletFrame *frame; gboolean handled = FALSE; + gboolean has_handle; + GdkRectangle handle_rect; frame = PANEL_APPLET_FRAME (widget); - if (!frame->priv->has_handle) + g_object_get (G_OBJECT (frame), + "has-handle", &has_handle, + "handle-rect", &handle_rect, + NULL); + + if (!has_handle) return handled; if (event->window != widget->window) @@ -803,7 +619,7 @@ switch (event->button) { case 1: case 2: - if (button_event_in_rect (event, &frame->priv->handle_rect)) { + if (button_event_in_rect (event, &handle_rect)) { if (event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS) { panel_widget_applet_drag_start ( @@ -816,28 +632,19 @@ } } break; - case 3: + case 3: if (event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS) { - CORBA_Environment env; - - CORBA_exception_init (&env); - gdk_pointer_ungrab (GDK_CURRENT_TIME); - - GNOME_Vertigo_PanelAppletShell_popup_menu ( - frame->priv->applet_shell, - event->button, - event->time, &env); - if (BONOBO_EX (&env)) - g_warning (_("Exception from popup_menu '%s'\n"), env._id); - - CORBA_exception_free (&env); + panel_applet_container_menu_popup ( + PANEL_APPLET_CONTAINER (frame), + event->button, + event->time); handled = TRUE; - - } else if (event->type == GDK_BUTTON_RELEASE) + } else if (event->type == GDK_BUTTON_RELEASE) { handled = TRUE; + } break; default: break; @@ -891,67 +698,47 @@ panel_profile_delete_object (info); } - g_object_unref (frame); + gtk_widget_destroy (GTK_WIDGET (frame)); gtk_widget_destroy (dialog); } static char * panel_applet_frame_get_name (char *iid) { - Bonobo_ServerInfoList *list; - char *query; - char *retval = NULL; - - query = g_strdup_printf ("iid == '%s'", iid); - - list = bonobo_activation_query (query, NULL, NULL); - if (list && list->_length > 0 && list->_buffer) { - Bonobo_ServerInfo *info = &list->_buffer [0]; - const char * const *langs; - GSList *langs_gslist; - int i; - - langs = g_get_language_names (); - - langs_gslist = NULL; - for (i = 0; langs[i]; i++) - langs_gslist = g_slist_prepend (langs_gslist, - (char *) langs[i]); - - langs_gslist = g_slist_reverse (langs_gslist); - - retval = g_strdup (bonobo_server_info_prop_lookup ( - info, "name", langs_gslist)); - - g_slist_free (langs_gslist); + PanelAppletManager *manager; + PanelAppletInfo *info; + char *retval = NULL; + + manager = panel_applet_manager_new (); + info = panel_applet_manager_get_applet_info (manager, iid); + if (info) { + retval = g_strdup (info->name); + panel_applet_info_free (info); } - - g_free (query); - CORBA_free (list); - + g_object_unref (manager); + return retval; } static void -panel_applet_frame_cnx_broken (ORBitConnection *cnx, - PanelAppletFrame *frame) +panel_applet_frame_cnx_broken (PanelAppletContainer *container) { - GtkWidget *dialog; - GdkScreen *screen; - char *applet_name = NULL; - char *dialog_txt; - - g_return_if_fail (PANEL_IS_APPLET_FRAME (frame)); + PanelAppletFrame *frame; + GtkWidget *dialog; + GdkScreen *screen; + char *applet_name = NULL; + char *dialog_txt; + frame = PANEL_APPLET_FRAME (container); + screen = gtk_widget_get_screen (GTK_WIDGET (frame)); - if (frame->priv->iid) - applet_name = panel_applet_frame_get_name (frame->priv->iid); + applet_name = panel_applet_frame_get_name (frame->priv->iid); if (applet_name) dialog_txt = g_strdup_printf (_("\"%s\" has quit unexpectedly"), applet_name); else - dialog_txt = g_strdup (_("Panel object has quit unexpectedly")); + dialog_txt = g_strdup (_("Panel object has quit unexpectedly")); dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, @@ -1006,14 +793,21 @@ const char *id) { GtkWidget *dialog; + char *applet_name; char *problem_txt; gboolean locked_down; locked_down = panel_lockdown_get_locked_down (); + applet_name = panel_applet_frame_get_name (frame->priv->iid); + + if (!applet_name) + applet_name = g_strdup (frame->priv->iid); + problem_txt = g_strdup_printf (_("The panel encountered a problem " "while loading \"%s\"."), - frame->priv->iid); + applet_name); + g_free (applet_name); dialog = gtk_message_dialog_new (NULL, 0, locked_down ? GTK_MESSAGE_INFO : GTK_MESSAGE_QUESTION, @@ -1046,9 +840,6 @@ gtk_widget_show_all (dialog); - g_free (frame->priv->iid); - frame->priv->iid = NULL; - gtk_widget_destroy (GTK_WIDGET (frame)); } @@ -1058,17 +849,19 @@ { GObjectClass *gobject_class = (GObjectClass *) klass; GtkWidgetClass *widget_class = (GtkWidgetClass *) klass; + PanelAppletContainerClass *container_class = + (PanelAppletContainerClass *) container_class; parent_class = g_type_class_peek_parent (klass); - gobject_class->finalize = panel_applet_frame_finalize; + gobject_class->dispose = panel_applet_frame_dispose; - widget_class->expose_event = panel_applet_frame_expose; - widget_class->size_request = panel_applet_frame_size_request; widget_class->size_allocate = panel_applet_frame_size_allocate; widget_class->button_press_event = panel_applet_frame_button_changed; widget_class->button_release_event = panel_applet_frame_button_changed; + container_class->applet_broken = panel_applet_frame_cnx_broken; + g_type_class_add_private (klass, sizeof (PanelAppletFramePrivate)); } @@ -1078,14 +871,8 @@ { frame->priv = PANEL_APPLET_FRAME_GET_PRIVATE (frame); - frame->priv->applet_shell = CORBA_OBJECT_NIL; - frame->priv->property_bag = CORBA_OBJECT_NIL; - frame->priv->ui_component = NULL; - frame->priv->panel = NULL; - frame->priv->orientation = PANEL_ORIENTATION_TOP; - frame->priv->applet_info = NULL; - frame->priv->moving_focus_out = FALSE; - frame->priv->has_handle = FALSE; + frame->priv->panel = NULL; + frame->priv->applet_info = NULL; } GType @@ -1107,7 +894,7 @@ NULL }; - type = g_type_register_static (GTK_TYPE_EVENT_BOX, + type = g_type_register_static (PANEL_TYPE_APPLET_CONTAINER, "PanelAppletFrame", &info, 0); } @@ -1115,273 +902,47 @@ return type; } -static GNOME_Vertigo_PanelAppletShell -panel_applet_frame_get_applet_shell (Bonobo_Control control) -{ - CORBA_Environment env; - GNOME_Vertigo_PanelAppletShell retval; - - CORBA_exception_init (&env); - - retval = Bonobo_Unknown_queryInterface (control, - "IDL:GNOME/Vertigo/PanelAppletShell:1.0", - &env); - if (BONOBO_EX (&env)) { - g_warning (_("Unable to obtain AppletShell interface from control\n")); - - retval = CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&env); - - return retval; -} - -static G_CONST_RETURN char * -panel_applet_frame_get_orient_string (PanelAppletFrame *frame, - PanelWidget *panel) -{ - PanelOrientation orientation; - const char *retval = NULL; - - orientation = panel_widget_get_applet_orientation (panel); - - switch (orientation) { - case PANEL_ORIENTATION_TOP: - retval = "down"; - break; - case PANEL_ORIENTATION_BOTTOM: - retval = "up"; - break; - case PANEL_ORIENTATION_LEFT: - retval = "right"; - break; - case PANEL_ORIENTATION_RIGHT: - retval = "left"; - break; - default: - g_assert_not_reached (); - break; - } - - return retval; -} - -static G_CONST_RETURN char * -panel_applet_frame_get_size_string (PanelAppletFrame *frame, - PanelWidget *panel) -{ - const char *retval = NULL; - - if (panel->sz <= PANEL_SIZE_XX_SMALL) - retval = "xx-small"; - else if (panel->sz <= PANEL_SIZE_X_SMALL) - retval = "x-small"; - else if (panel->sz <= PANEL_SIZE_SMALL) - retval = "small"; - else if (panel->sz <= PANEL_SIZE_MEDIUM) - retval = "medium"; - else if (panel->sz <= PANEL_SIZE_LARGE) - retval = "large"; - else if (panel->sz <= PANEL_SIZE_X_LARGE) - retval = "x-large"; - else - retval = "xx-large"; - - return retval; -} - -static char * -panel_applet_frame_construct_moniker (PanelAppletFrame *frame, - PanelWidget *panel, - const char *iid, - const char *id) -{ - char *retval; - char *bg_str; - gboolean locked_down; - - bg_str = panel_applet_frame_get_background_string ( - frame, panel, panel->background.type); - - if (bg_str == NULL) - bg_str = g_strdup (""); - - locked_down = panel_lockdown_get_locked_down (); - - retval = g_strdup_printf ( - "%s!prefs_key=/apps/panel/applets/%s/prefs;" - "background=%s;orient=%s;size=%s;locked_down=%s", - iid, id, bg_str, - panel_applet_frame_get_orient_string (frame, panel), - panel_applet_frame_get_size_string (frame, panel), - locked_down ? "true" : "false"); - - g_free (bg_str); - - return retval; -} - -static void -panel_applet_frame_event_listener (BonoboListener *listener, - const char *event, - const CORBA_any *any, - CORBA_Environment *ev, - PanelAppletFrame *frame) -{ - if (!strcmp (event, "Bonobo/Property:change:" PROPERTY_FLAGS)) - panel_applet_frame_set_flags_from_any (frame, any); - - else if (!strcmp (event, "Bonobo/Property:change:" PROPERTY_SIZE_HINTS)) - panel_applet_frame_set_size_hints_from_any (frame, any); -} - -static void -panel_applet_frame_activated (Bonobo_Unknown object, - CORBA_Environment *ev, - gpointer *data) +static gboolean +panel_applet_frame_activated (PanelAppletContainer *container, + GError *error, + gpointer user_data) { PanelAppletFrameActivating *frame_act; - PanelAppletFrame *frame; - GtkWidget *widget; - BonoboControlFrame *control_frame; - Bonobo_Control control; - CORBA_Environment corba_ev; - AppletInfo *info; - char *error; - - frame_act = (PanelAppletFrameActivating *) data; - frame = frame_act->frame; - - /* according to the source of bonobo control == NULL && no - exception can happen, so handle it */ - if (BONOBO_EX (ev) || object == CORBA_OBJECT_NIL) { - error = bonobo_exception_get_text (ev); - g_warning (G_STRLOC ": failed to load applet %s:\n%s", - frame->priv->iid, error); - panel_applet_frame_loading_failed (frame, frame_act->id); - g_free (frame_act->id); - g_free (frame_act); - g_free (error); - return; - } - - frame->priv->control = CORBA_Object_duplicate (object, NULL); + PanelAppletFrame *frame; + AppletInfo *info; - widget = bonobo_widget_new_control_from_objref (object, - CORBA_OBJECT_NIL); + frame_act = (PanelAppletFrameActivating *) user_data; + frame = PANEL_APPLET_FRAME (container); - bonobo_object_release_unref (object, NULL); + if (error) { + g_warning (error->message); + g_clear_error (&error); - if (!widget) { - g_warning (G_STRLOC ": failed to load applet %s", - frame->priv->iid); panel_applet_frame_loading_failed (frame, frame_act->id); - g_free (frame_act->id); - g_free (frame_act); - return; - } - control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (widget)); - if (control_frame == NULL) { - g_warning (G_STRLOC ": failed to load applet %s " - "(can't get control frame)", frame->priv->iid); - panel_applet_frame_loading_failed (frame, frame_act->id); - gtk_object_sink (GTK_OBJECT (widget)); g_free (frame_act->id); g_free (frame_act); - return; - } - frame->priv->property_bag = - bonobo_control_frame_get_control_property_bag (control_frame, - &corba_ev); - if (frame->priv->property_bag == NULL || BONOBO_EX (&corba_ev)) { - error = bonobo_exception_get_text (&corba_ev); - CORBA_exception_free (&corba_ev); - g_warning (G_STRLOC ": failed to load applet %s " - "(can't get property bag):\n%s", - frame->priv->iid, error); - panel_applet_frame_loading_failed (frame, frame_act->id); - gtk_object_sink (GTK_OBJECT (widget)); - g_free (frame_act->id); - g_free (frame_act); - g_free (error); - return; + return FALSE; } - bonobo_event_source_client_add_listener (frame->priv->property_bag, - (BonoboListenerCallbackFn) panel_applet_frame_event_listener, - "Bonobo/Property:change:panel-applet", - NULL, + panel_applet_container_menu_add_actions (PANEL_APPLET_CONTAINER (frame), + popup_actions, + G_N_ELEMENTS (popup_actions), frame); - - frame->priv->ui_component = - bonobo_control_frame_get_popup_component (control_frame, - &corba_ev); - if (frame->priv->ui_component == NULL || BONOBO_EX (&corba_ev)) { - error = bonobo_exception_get_text (&corba_ev); - CORBA_exception_free (&corba_ev); - g_warning (G_STRLOC ": failed to load applet %s " - "(can't get popup component):\n%s", - frame->priv->iid, error); - panel_applet_frame_loading_failed (frame, frame_act->id); - gtk_object_sink (GTK_OBJECT (widget)); - g_free (frame_act->id); - g_free (frame_act); - g_free (error); - return; - } - - bonobo_ui_util_set_ui (frame->priv->ui_component, DATADIR, - "GNOME_Panel_Popup.xml", "panel", NULL); - - bonobo_ui_component_add_listener (frame->priv->ui_component, - "LockAppletToPanel", - listener_popup_handle_lock, - frame); - - bonobo_ui_component_add_verb_list_with_data ( - frame->priv->ui_component, popup_verbs, frame); - - control = bonobo_control_frame_get_control (control_frame); - if (!control) { - CORBA_exception_free (&corba_ev); - g_warning (G_STRLOC ": failed to load applet %s " - "(can't get control)", frame->priv->iid); - panel_applet_frame_loading_failed (frame, frame_act->id); - gtk_object_sink (GTK_OBJECT (widget)); - g_free (frame_act->id); - g_free (frame_act); - return; - } - - frame->priv->applet_shell = panel_applet_frame_get_applet_shell (control); - if (frame->priv->applet_shell == CORBA_OBJECT_NIL) { - CORBA_exception_free (&corba_ev); - g_warning (G_STRLOC ": failed to load applet %s " - "(can't get applet shell)", frame->priv->iid); - panel_applet_frame_loading_failed (frame, frame_act->id); - gtk_object_sink (GTK_OBJECT (widget)); - g_free (frame_act->id); - g_free (frame_act); - return; - } - - CORBA_exception_free (&corba_ev); - - ORBit_small_listen_for_broken (object, - G_CALLBACK (panel_applet_frame_cnx_broken), - frame); - - gtk_container_add (GTK_CONTAINER (frame), widget); - - gtk_widget_show_all (GTK_WIDGET (frame)); + panel_applet_container_menu_add_toggle_actions (PANEL_APPLET_CONTAINER (frame), + popup_toggle_actions, + G_N_ELEMENTS (popup_toggle_actions), + frame); + panel_applet_container_menu_add_ui_from_file (PANEL_APPLET_CONTAINER (frame), + NULL, + "GNOME_Panel_Popup.xml", + NULL); info = panel_applet_register (GTK_WIDGET (frame), GTK_WIDGET (frame), NULL, frame->priv->panel, frame_act->locked, frame_act->position, - frame_act->exactpos, PANEL_OBJECT_BONOBO, + frame_act->exactpos, PANEL_OBJECT_APPLET, frame_act->id); frame->priv->applet_info = info; @@ -1396,6 +957,8 @@ g_free (frame_act->id); g_free (frame_act); + + return TRUE; } void Index: gnome-panel/panel-applet-frame.h =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-applet-frame.h,v retrieving revision 1.35 diff -u -u -r1.35 panel-applet-frame.h --- gnome-panel/panel-applet-frame.h 2 Jan 2005 12:57:44 -0000 1.35 +++ gnome-panel/panel-applet-frame.h 27 Feb 2006 11:18:18 -0000 @@ -25,7 +25,7 @@ #ifndef __PANEL_APPLET_FRAME_H__ #define __PANEL_APPLET_FRAME_H__ -#include +#include #include "panel-widget.h" #include "applet.h" @@ -44,13 +44,13 @@ typedef struct _PanelAppletFramePrivate PanelAppletFramePrivate; struct _PanelAppletFrame{ - GtkEventBox event_box; + PanelAppletContainer parent; PanelAppletFramePrivate *priv; }; struct _PanelAppletFrameClass { - GtkEventBoxClass event_box_class; + PanelAppletContainerClass parent_class; }; GType panel_applet_frame_get_type (void) G_GNUC_CONST; @@ -65,7 +65,7 @@ PanelOrientation orientation); void panel_applet_frame_change_size (PanelAppletFrame *frame, - PanelSize size); + gint size); void panel_applet_frame_change_background (PanelAppletFrame *frame, PanelBackgroundType type); Index: gnome-panel/panel-compatibility.c =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-compatibility.c,v retrieving revision 1.18 diff -u -u -r1.18 panel-compatibility.c --- gnome-panel/panel-compatibility.c 22 Jan 2006 12:08:24 -0000 1.18 +++ gnome-panel/panel-compatibility.c 27 Feb 2006 11:18:18 -0000 @@ -34,10 +34,10 @@ #include "panel-util.h" typedef enum { - PANEL_ORIENT_UP = GNOME_Vertigo_PANEL_ORIENT_UP, - PANEL_ORIENT_DOWN = GNOME_Vertigo_PANEL_ORIENT_DOWN, - PANEL_ORIENT_LEFT = GNOME_Vertigo_PANEL_ORIENT_LEFT, - PANEL_ORIENT_RIGHT = GNOME_Vertigo_PANEL_ORIENT_RIGHT + PANEL_ORIENT_UP, + PANEL_ORIENT_DOWN, + PANEL_ORIENT_LEFT, + PANEL_ORIENT_RIGHT } PanelOrient; static GConfEnumStringPair panel_orient_map [] = { @@ -524,7 +524,7 @@ g_free (id); /* window menu on far left corner */ - id = panel_profile_prepare_object_with_id (PANEL_OBJECT_BONOBO, toplevel_id, 0, TRUE); + id = panel_profile_prepare_object_with_id (PANEL_OBJECT_APPLET, toplevel_id, 0, TRUE); key = panel_gconf_full_key (PANEL_GCONF_APPLETS, id, "bonobo_iid"); gconf_client_set_string (client, key, "OAFIID:GNOME_WindowMenuApplet", NULL); Index: gnome-panel/panel-enums.h =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-enums.h,v retrieving revision 1.11 diff -u -u -r1.11 panel-enums.h --- gnome-panel/panel-enums.h 22 Jan 2006 12:08:24 -0000 1.11 +++ gnome-panel/panel-enums.h 27 Feb 2006 11:18:18 -0000 @@ -78,7 +78,7 @@ PANEL_OBJECT_DRAWER, PANEL_OBJECT_MENU, PANEL_OBJECT_LAUNCHER, - PANEL_OBJECT_BONOBO, + PANEL_OBJECT_APPLET, PANEL_OBJECT_ACTION, PANEL_OBJECT_MENU_BAR, PANEL_OBJECT_SEPARATOR, Index: gnome-panel/panel-lockdown.c =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-lockdown.c,v retrieving revision 1.3 diff -u -u -r1.3 panel-lockdown.c --- gnome-panel/panel-lockdown.c 10 Jan 2005 16:41:00 -0000 1.3 +++ gnome-panel/panel-lockdown.c 27 Feb 2006 11:18:18 -0000 @@ -433,7 +433,8 @@ callback_func, user_data); - g_assert (closure != NULL); + if (!closure) + return; panel_lockdown.closures = g_slist_remove (panel_lockdown.closures, closure); Index: gnome-panel/panel-object.schemas.in =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-object.schemas.in,v retrieving revision 1.7 diff -u -u -r1.7 panel-object.schemas.in --- gnome-panel/panel-object.schemas.in 28 Jan 2005 23:41:09 -0000 1.7 +++ gnome-panel/panel-object.schemas.in 27 Feb 2006 11:18:18 -0000 @@ -15,7 +15,7 @@ The type of this panel object. Possible values are "drawer-object", "menu-object", "launcher-object", - "bonobo-applet", "action-applet" and "menu-bar". + "gnome-applet", "action-applet" and "menu-bar". @@ -80,16 +80,16 @@ - /schemas/apps/panel/objects/bonobo_iid + /schemas/apps/panel/objects/applet_id panel string - Applet Bonobo IID + Applet Identifier - The Bonobo implementation ID of the applet - e.g. - "OAFIID:GNOME_ClockApplet". This key is only - relevant if the object_type key is "bonobo-applet". + The identifier of the applet - e.g. + "Clock". This key is only + relevant if the object_type key is "gnome-applet". Index: gnome-panel/panel-profile.c =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-profile.c,v retrieving revision 1.54 diff -u -u -r1.54 panel-profile.c --- gnome-panel/panel-profile.c 23 Jan 2006 08:24:46 -0000 1.54 +++ gnome-panel/panel-profile.c 27 Feb 2006 11:18:18 -0000 @@ -93,7 +93,7 @@ { PANEL_OBJECT_DRAWER, "drawer-object" }, { PANEL_OBJECT_MENU, "menu-object" }, { PANEL_OBJECT_LAUNCHER, "launcher-object" }, - { PANEL_OBJECT_BONOBO, "bonobo-applet" }, + { PANEL_OBJECT_APPLET, "gnome-applet" }, { PANEL_OBJECT_ACTION, "action-applet" }, { PANEL_OBJECT_MENU_BAR, "menu-bar" }, { PANEL_OBJECT_SEPARATOR, "separator" }, @@ -1753,7 +1753,7 @@ char *id; char *dir; - key_type = (object_type == PANEL_OBJECT_BONOBO) ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS; + key_type = (object_type == PANEL_OBJECT_APPLET) ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS; client = panel_gconf_get_client (); @@ -1802,7 +1802,7 @@ PanelGConfKeyType type; const char *id; - type = (applet_info->type) == PANEL_OBJECT_BONOBO ? PANEL_GCONF_APPLETS : + type = (applet_info->type) == PANEL_OBJECT_APPLET ? PANEL_GCONF_APPLETS : PANEL_GCONF_OBJECTS; id = panel_applet_get_id (applet_info); @@ -1843,7 +1843,7 @@ key = panel_gconf_sprintf ("%s/position", object_dir); position = gconf_client_get_int (client, key, NULL); - + key = panel_gconf_sprintf ("%s/toplevel_id", object_dir); toplevel_id = gconf_client_get_string (client, key, NULL); @@ -2107,8 +2107,8 @@ for (l = existing_applets; l; l = l->next) { AppletInfo *info = l->data; - if ((type == PANEL_GCONF_APPLETS && info->type == PANEL_OBJECT_BONOBO) || - (type == PANEL_GCONF_OBJECTS && info->type != PANEL_OBJECT_BONOBO)) + if ((type == PANEL_GCONF_APPLETS && info->type == PANEL_OBJECT_APPLET) || + (type == PANEL_GCONF_OBJECTS && info->type != PANEL_OBJECT_APPLET)) sublist = g_slist_prepend (sublist, info); } Index: gnome-panel/panel-shell.c =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-shell.c,v retrieving revision 1.19 diff -u -u -r1.19 panel-shell.c --- gnome-panel/panel-shell.c 19 Nov 2005 14:49:09 -0000 1.19 +++ gnome-panel/panel-shell.c 27 Feb 2006 11:18:18 -0000 @@ -22,76 +22,130 @@ * Jacob Berkman */ -#include #include -#include #include +#include #include "panel-shell.h" #include "panel-util.h" +#include "panel-run-dialog.h" + +static gboolean impl_displayRunDialog (PanelShell *shell, GError *error); + +#include "panel-shell-glue.h" + +static void panel_shell_class_init (PanelShellClass *klass); +static void panel_shell_init (PanelShell *shell); + +struct _PanelShellPrivate { + DBusGConnection *connection; +}; + +#define PANEL_SHELL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_SHELL_TYPE, PanelShellPrivate)) + +#define PANEL_SHELL_PATH "/org/gnome/panel/shell" +#define PANEL_SHELL_SERVICE "org.gnome.panel.Shell" /* * PanelShell is a singleton. */ static PanelShell *panel_shell = NULL; -static Bonobo_RegistrationResult -panel_shell_bonobo_activation_register_for_display (const char *iid, - Bonobo_Unknown ref) -{ - const char *display_name; - GSList *reg_env ; - Bonobo_RegistrationResult result; - - display_name = gdk_display_get_name (gdk_display_get_default ()); - reg_env = bonobo_activation_registration_env_set (NULL, - "DISPLAY", - display_name); - result = bonobo_activation_register_active_server (iid, ref, reg_env); - bonobo_activation_registration_env_free (reg_env); - return result; +GType +panel_shell_get_type (void) +{ + static GType type = 0; + + if (!type) { + static const GTypeInfo info = { + sizeof (PanelShellClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) panel_shell_class_init, + NULL, + NULL, + sizeof (PanelShell), + 0, + (GInstanceInitFunc) panel_shell_init + }; + + type = g_type_register_static (G_TYPE_OBJECT, "PanelShell", + &info, 0); + } + + return type; +} + +static void +panel_shell_error_dialog_show (const gchar *message) +{ + GtkWidget *dialog; + + dialog = panel_error_dialog ( + gdk_screen_get_default (), + "panel_shell_register_error", + FALSE, "%s", NULL, message); + + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); } gboolean panel_shell_register (void) { - if (!panel_shell) { - Bonobo_RegistrationResult reg_res; - char *message = NULL; - - panel_shell = g_object_new (PANEL_SHELL_TYPE, NULL); - bonobo_object_set_immortal (BONOBO_OBJECT (panel_shell), TRUE); - - reg_res = panel_shell_bonobo_activation_register_for_display - ("OAFIID:GNOME_PanelShell", - BONOBO_OBJREF (panel_shell)); - - switch (reg_res) { - case Bonobo_ACTIVATION_REG_SUCCESS: - break; - case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE: - message = _("I've detected a panel already running,\n" - "and will now exit."); - break; - default: - message = g_strdup_printf (_("There was a problem registering the panel " - "with the bonobo-activation server.\n" - "The error code is: %d\n" - "The panel will now exit."), reg_res); - break; - } - - if (message) { - GtkWidget *dlg = panel_error_dialog ( - gdk_screen_get_default (), - "panel_shell_register_error", - FALSE, "%s", NULL, message); - - gtk_dialog_run (GTK_DIALOG (dlg)); - gtk_widget_destroy (dlg); - return FALSE; - } + DBusGProxy *bus_proxy; + GError *error = NULL; + gchar *message = NULL; + guint32 request_name_ret; + + if (panel_shell) + return TRUE; + + panel_shell = g_object_new (PANEL_SHELL_TYPE, NULL); + + panel_shell->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); + if (error) { + g_warning (error->message); + panel_shell_error_dialog_show (error->message); + g_clear_error (&error); + + return FALSE; + } + + dbus_g_connection_register_g_object (panel_shell->priv->connection, + PANEL_SHELL_PATH, + G_OBJECT (panel_shell)); + + bus_proxy = dbus_g_proxy_new_for_name (panel_shell->priv->connection, + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); + + if (!org_freedesktop_DBus_request_name (bus_proxy, PANEL_SHELL_SERVICE, + DBUS_NAME_FLAG_DO_NOT_QUEUE, + &request_name_ret, &error)) { + g_warning ("Failed to get name: %s\n", error->message); + message = g_strdup_printf (_("There was a problem registering the panel " + "with the session bus.\n" + "The error message is: %s\n" + "The panel will now exit."), error->message); + panel_shell_error_dialog_show (error->message); + g_free (message); + + g_clear_error (&error); + g_object_unref (bus_proxy); + + return FALSE; + } + + g_object_unref (bus_proxy); + + if (request_name_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { + panel_shell_error_dialog_show (_("I've detected a panel already running,\n" + "and will now exit.")); + + return FALSE; } return TRUE; @@ -100,35 +154,33 @@ void panel_shell_unregister (void) { - bonobo_activation_unregister_active_server ("OAFIID:GNOME_PanelShell", - BONOBO_OBJREF (panel_shell)); + dbus_g_connection_register_g_object (panel_shell->priv->connection, + PANEL_SHELL_PATH, + G_OBJECT (panel_shell)); } -static void -impl_displayRunDialog (PortableServer_Servant servant, - const CORBA_char *initial_string, - CORBA_Environment *ev) +static gboolean +impl_displayRunDialog (PanelShell *shell, GError *error) { - PanelShell *shell; - - shell = PANEL_SHELL (bonobo_object (servant)); - - g_message ("displayRunDialog: %s\n", initial_string); + panel_run_dialog_present (gdk_screen_get_default (), + gtk_get_current_event_time ()); + return TRUE; } static void panel_shell_class_init (PanelShellClass *klass) { - klass->epv.displayRunDialog = impl_displayRunDialog; + g_type_class_add_private (klass, sizeof (PanelShellPrivate)); + + dbus_g_object_type_install_info (PANEL_SHELL_TYPE, + &dbus_glib_panel_shell_object_info); } static void panel_shell_init (PanelShell *shell) { + shell->priv = PANEL_SHELL_GET_PRIVATE (shell); + shell->priv->connection = NULL; } -BONOBO_TYPE_FUNC_FULL (PanelShell, - GNOME_Vertigo_PanelShell, - BONOBO_OBJECT_TYPE, - panel_shell) Index: gnome-panel/panel-shell.h =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-shell.h,v retrieving revision 1.5 diff -u -u -r1.5 panel-shell.h --- gnome-panel/panel-shell.h 13 Nov 2003 12:31:02 -0000 1.5 +++ gnome-panel/panel-shell.h 27 Feb 2006 11:18:18 -0000 @@ -25,9 +25,7 @@ #ifndef __PANEL_SHELL_H__ #define __PANEL_SHELL_H__ -#include "GNOME_Panel.h" - -#include +#include #define PANEL_SHELL_TYPE (panel_shell_get_type ()) #define PANEL_SHELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PANEL_SHELL_TYPE, PanelShell)) @@ -35,15 +33,21 @@ #define PANEL_IS_SHELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PANEL_SHELL_TYPE)) #define PANEL_IS_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PANEL_SHELL_TYPE)) -typedef BonoboObject PanelShell; +typedef struct _PanelShell PanelShell; +typedef struct _PanelShellClass PanelShellClass; +typedef struct _PanelShellPrivate PanelShellPrivate; + +struct _PanelShell { + GObject parent; -typedef struct { - BonoboObjectClass parent_class; + PanelShellPrivate *priv; +}; - POA_GNOME_Vertigo_PanelShell__epv epv; -} PanelShellClass; +struct _PanelShellClass { + GObjectClass parent_class; +}; -GType panel_shell_get_type (void) G_GNUC_CONST; +GType panel_shell_get_type (void) G_GNUC_CONST; gboolean panel_shell_register (void); void panel_shell_unregister (void); Index: gnome-panel/panel-types.h =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-types.h,v retrieving revision 1.33 diff -u -u -r1.33 panel-types.h --- gnome-panel/panel-types.h 5 Mar 2003 01:11:35 -0000 1.33 +++ gnome-panel/panel-types.h 27 Feb 2006 11:18:18 -0000 @@ -4,16 +4,15 @@ #include #include -#include "GNOME_Panel.h" typedef enum { - PANEL_SIZE_XX_SMALL = GNOME_Vertigo_PANEL_XX_SMALL, - PANEL_SIZE_X_SMALL = GNOME_Vertigo_PANEL_X_SMALL, - PANEL_SIZE_SMALL = GNOME_Vertigo_PANEL_SMALL, - PANEL_SIZE_MEDIUM = GNOME_Vertigo_PANEL_MEDIUM, - PANEL_SIZE_LARGE = GNOME_Vertigo_PANEL_LARGE, - PANEL_SIZE_X_LARGE = GNOME_Vertigo_PANEL_X_LARGE, - PANEL_SIZE_XX_LARGE = GNOME_Vertigo_PANEL_XX_LARGE + PANEL_SIZE_XX_SMALL = 12, + PANEL_SIZE_X_SMALL = 24, + PANEL_SIZE_SMALL = 36, + PANEL_SIZE_MEDIUM = 48, + PANEL_SIZE_LARGE = 64, + PANEL_SIZE_X_LARGE = 80, + PANEL_SIZE_XX_LARGE = 128 } PanelSize; typedef enum { Index: gnome-panel/panel-widget.c =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-widget.c,v retrieving revision 1.382 diff -u -u -r1.382 panel-widget.c --- gnome-panel/panel-widget.c 22 Oct 2005 08:28:52 -0000 1.382 +++ gnome-panel/panel-widget.c 27 Feb 2006 11:18:22 -0000 @@ -2501,12 +2501,13 @@ (GCompareFunc)applet_data_compare); /*this will get done right on size allocate!*/ - if(panel->orient == GTK_ORIENTATION_HORIZONTAL) + if(panel->orient == GTK_ORIENTATION_HORIZONTAL) { gtk_fixed_put(GTK_FIXED(panel),applet, pos,0); - else + } else { gtk_fixed_put(GTK_FIXED(panel),applet, 0,pos); + } gtk_widget_queue_resize(GTK_WIDGET(panel)); @@ -2561,7 +2562,7 @@ focus_widget = gtk_window_get_focus (GTK_WINDOW (old_panel->toplevel)); gtk_widget_reparent (applet, GTK_WIDGET (new_panel)); - if (info && info->type == PANEL_OBJECT_BONOBO) + if (info && info->type == PANEL_OBJECT_APPLET) panel_applet_frame_set_panel (PANEL_APPLET_FRAME (ad->applet), new_panel); if (GTK_WIDGET_CAN_FOCUS (new_panel)) Index: gnome-panel/panel.c =================================================================== RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel.c,v retrieving revision 1.570 diff -u -u -r1.570 panel.c --- gnome-panel/panel.c 26 Jan 2006 16:46:24 -0000 1.570 +++ gnome-panel/panel.c 27 Feb 2006 11:18:22 -0000 @@ -71,7 +71,7 @@ orientation = panel_widget_get_applet_orientation (panel); switch (info->type) { - case PANEL_OBJECT_BONOBO: + case PANEL_OBJECT_APPLET: panel_applet_frame_change_orientation ( PANEL_APPLET_FRAME (info->widget), orientation); break; @@ -131,7 +131,7 @@ size_change (AppletInfo *info, PanelWidget *panel) { - if (info->type == PANEL_OBJECT_BONOBO) + if (info->type == PANEL_OBJECT_APPLET) panel_applet_frame_change_size ( PANEL_APPLET_FRAME (info->widget), panel->sz); } @@ -158,7 +158,7 @@ PanelWidget *panel) { switch (info->type) { - case PANEL_OBJECT_BONOBO: + case PANEL_OBJECT_APPLET: panel_applet_frame_change_background ( PANEL_APPLET_FRAME (info->widget), panel->background.type); break; Index: libpanel-applet/Makefile.am =================================================================== RCS file: /cvs/gnome/gnome-panel/libpanel-applet/Makefile.am,v retrieving revision 1.24 diff -u -u -r1.24 Makefile.am --- libpanel-applet/Makefile.am 30 Oct 2004 21:04:58 -0000 1.24 +++ libpanel-applet/Makefile.am 27 Feb 2006 11:18:23 -0000 @@ -14,14 +14,21 @@ panel-applet.c \ panel-applet-gconf.c \ panel-applet-gconf.h \ - panel-applet-shell.c \ - panel-applet-shell.h \ + panel-applet-factory.c \ + panel-applet-factory.h \ + panel-applet-menu.c \ + panel-applet-menu.h \ panel-applet-private.h \ panel-applet-marshal.c \ panel-applet-marshal.h \ panel-applet-enums.c \ panel-applet-enums.h \ - $(CORBA_SRCLIST) + panel-applet-container.c \ + panel-applet-container.h \ + panel-applet-manager.c \ + panel-applet-manager.h \ + $(DBUS_SRCLIST) + libpanel_applet_2_la_LDFLAGS = \ -version-info $(LIB_PANEL_APPLET_LT_VERSION) \ @@ -32,20 +39,28 @@ libpanel_appletinclude_HEADERS = \ panel-applet.h \ + panel-applet-factory.h \ + panel-applet-menu.h \ + panel-applet-container.h \ panel-applet-gconf.h \ - panel-applet-enums.h \ - GNOME_Panel.h + panel-applet-enums.h + +DBUS_SRCLIST = \ + panel-applet-factory-glue.h \ + panel-applet-menu-glue.h \ + panel-applet-glue.h -CORBA_SRCLIST = \ - GNOME_Panel-stubs.c \ - GNOME_Panel-skels.c \ - GNOME_Panel-common.c \ - GNOME_Panel.h +panel-applet-factory-glue.h: panel-applet-factory.xml + dbus-binding-tool --prefix=panel_applet_factory --mode=glib-server --output=$@ $^ -$(CORBA_SRCLIST): $(top_srcdir)/idl/GNOME_Panel.idl $(ORBIT_IDL) - $(ORBIT_IDL) -I $(BONOBO_IDLDIR) -I $(BONOBO_ACT_IDLDIR) $(top_srcdir)/idl/GNOME_Panel.idl +panel-applet-menu-glue.h: panel-applet-menu.xml + dbus-binding-tool --prefix=panel_applet_container_menu --mode=glib-server --output=$@ $^ -noinst_PROGRAMS = test-bonobo-applet +panel-applet-glue.h: panel-applet.xml + dbus-binding-tool --prefix=panel_applet --mode=glib-server --output=$@ $^ + +noinst_PROGRAMS = test-applet \ + test-bonobo-applet bin_PROGRAMS = panel-test-applets @@ -54,21 +69,27 @@ $(LIBPANEL_APPLET_LIBS) \ libpanel-applet-2.la -test_bonobo_applet_LDADD = \ +test_applet_LDADD = \ $(LIBPANEL_APPLET_LIBS) \ libpanel-applet-2.la +test_bonobo_applet_LDADD = \ + $(LIBPANEL_APPLET_LIBS) \ + libpanel-applet-2.la + BUILT_SOURCES = \ - $(CORBA_SRCLIST) \ + $(DBUS_SRCLIST) \ panel-applet-enums.c \ panel-applet-enums.h \ panel-applet-marshal.c \ panel-applet-marshal.h -$(libpanel_applet_2_la_OBJECTS) $(test_bonobo_applet_OBJECTS): $(BUILT_SOURCES) +$(libpanel_applet_2_la_OBJECTS) $(test_applet_OBJECTS): $(BUILT_SOURCES) EXTRA_DIST = \ - GNOME_Panel_TestApplet.server.in \ + panel-applet-factory.xml \ + panel-applet.xml \ + panel-applet-menu.xml \ panel-applet-marshal.list \ libpanelapplet-2.0.pc.in \ libpanelapplet-2.0-uninstalled.pc.in \ @@ -116,12 +137,6 @@ pkgconfig_DATA = libpanelapplet-2.0.pc CLEANFILES = $(BUILT_SOURCES) $(noinst_DATA) - -serverdir = $(libdir)/bonobo/servers -server_in_files = GNOME_Panel_TestApplet.server.in -noinst_DATA = $(server_in_files:.server.in=.server) - -@INTLTOOL_SERVER_RULE@ dist-hook: cd $(distdir) ; rm -f $(CLEANFILES) Index: libpanel-applet/libpanelapplet-2.0-uninstalled.pc.in =================================================================== RCS file: /cvs/gnome/gnome-panel/libpanel-applet/libpanelapplet-2.0-uninstalled.pc.in,v retrieving revision 1.1 diff -u -u -r1.1 libpanelapplet-2.0-uninstalled.pc.in --- libpanel-applet/libpanelapplet-2.0-uninstalled.pc.in 17 Feb 2004 11:22:27 -0000 1.1 +++ libpanel-applet/libpanelapplet-2.0-uninstalled.pc.in 27 Feb 2006 11:18:23 -0000 @@ -5,7 +5,7 @@ Name: libpanel-applet-2 Description: libpanel-applet-2 -Requires: gtk+-2.0 libgnomeui-2.0 libbonoboui-2.0 +Requires: gtk+-2.0 libgnomeui-2.0 dbus-glib-1 Version: @VERSION@ Libs: ${pc_top_builddir}/${pcfiledir}/libpanel-applet-2.la Cflags: -I${pc_top_builddir}/${pcfiledir} Index: libpanel-applet/libpanelapplet-2.0.pc.in =================================================================== RCS file: /cvs/gnome/gnome-panel/libpanel-applet/libpanelapplet-2.0.pc.in,v retrieving revision 1.4 diff -u -u -r1.4 libpanelapplet-2.0.pc.in --- libpanel-applet/libpanelapplet-2.0.pc.in 30 Nov 2001 16:25:05 -0000 1.4 +++ libpanel-applet/libpanelapplet-2.0.pc.in 27 Feb 2006 11:18:23 -0000 @@ -5,7 +5,7 @@ Name: libpanel-applet-2 Description: libpanel-applet-2 -Requires: gtk+-2.0 libgnomeui-2.0 libbonoboui-2.0 +Requires: gtk+-2.0 libgnomeui-2.0 dbus-glib-1 Version: @VERSION@ Libs: -L${libdir} -lpanel-applet-2 Cflags: -I${includedir}/panel-2.0 Index: libpanel-applet/panel-applet-marshal.list =================================================================== RCS file: /cvs/gnome/gnome-panel/libpanel-applet/panel-applet-marshal.list,v retrieving revision 1.7 diff -u -u -r1.7 panel-applet-marshal.list --- libpanel-applet/panel-applet-marshal.list 4 Feb 2004 15:02:32 -0000 1.7 +++ libpanel-applet/panel-applet-marshal.list 27 Feb 2006 11:18:23 -0000 @@ -3,3 +3,6 @@ VOID:UINT VOID:ENUM BOOLEAN:STRING +VOID:STRING +VOID:BOXED +VOID:VOID Index: libpanel-applet/panel-applet.c =================================================================== RCS file: /cvs/gnome/gnome-panel/libpanel-applet/panel-applet.c,v retrieving revision 1.101 diff -u -u -r1.101 panel-applet.c --- libpanel-applet/panel-applet.c 9 Jan 2006 20:00:29 -0000 1.101 +++ libpanel-applet/panel-applet.c 27 Feb 2006 11:18:23 -0000 @@ -36,53 +36,93 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include +/* Compatibility */ +#include +#include +#include +#include + #include "panel-applet.h" -#include "panel-applet-private.h" -#include "panel-applet-shell.h" #include "panel-applet-marshal.h" #include "panel-applet-enums.h" -#define PANEL_APPLET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_APPLET, PanelAppletPrivate)) +static gboolean panel_applet_get_xid (PanelApplet *applet, + gint IN_screen, + guint32 *OUT_xid, + GError **error); +static gboolean panel_applet_popup_menu (PanelApplet *applet, + guint IN_button, + guint32 IN_time, + GError **error); +static gboolean panel_applet_notify_add (PanelApplet *applet, + const gchar *IN_property, + GError **error); + +#include "panel-applet-glue.h" + +/* Compatibility */ +/*typedef struct _PopupUIComponent PopupUIComponent; +typedef struct _PopupUIComponentClass PopupUIComponentClass; -struct _PanelAppletPrivate { - PanelAppletShell *shell; - BonoboControl *control; - BonoboPropertyBag *prop_sack; - BonoboItemHandler *item_handler; - GConfClient *client; - - char *iid; - GClosure *closure; - gboolean bound; - char *prefs_key; - - PanelAppletFlags flags; - PanelAppletOrient orient; - guint size; - char *background; - GtkWidget *background_widget; - - int previous_width; - int previous_height; +struct _PopupUIComponent { + BonoboUIComponent parent; +}; + +struct _PopupUIComponentClass { + BonoboUIComponentClass parent_class; +}; - int *size_hints; - int size_hints_len; +static GType popup_ui_component_get_type (void); +static void popup_ui_component_init (PopupUIComponent *component); +static void popup_ui_component_class_init (PopupUIComponentClass *klass); +G_DEFINE_TYPE (PopupUIComponent, popup_ui_component, BONOBO_TYPE_UI_COMPONENT) +#define POPUP_TYPE_UI_COMPONENT (popup_ui_component_get_type ())*/ - gboolean moving_focus_out; - gboolean locked_down; +#define PANEL_APPLET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_APPLET, PanelAppletPrivate)) + +struct _PanelAppletPrivate { + GtkWidget *plug; + GtkWidget *applet; + guint32 xid; + PanelAppletMenu *menu; + GConfClient *client; + + gchar *id; + GClosure *closure; + gboolean embedded; + gchar *prefs_key; + + PanelAppletFlags flags; + PanelAppletOrient orient; + guint size; + gchar *background; + GtkWidget *background_widget; + + int previous_width; + int previous_height; + GArray *size_hints; + + gboolean moving_focus_out; + + gboolean locked_down; + + GHashTable *notifies; + + /* Compatibility */ + gchar *iid; + GtkWidget *dummy; + BonoboControl *control; + BonoboUIComponent *popup_component; }; static GObjectClass *parent_class; @@ -93,25 +133,25 @@ CHANGE_BACKGROUND, MOVE_FOCUS_OUT_OF_APPLET, SAVE_YOURSELF, + PROPERTY_CHANGED, LAST_SIGNAL }; static guint panel_applet_signals [LAST_SIGNAL]; -#define PROPERTY_ORIENT "panel-applet-orient" -#define PROPERTY_SIZE "panel-applet-size" -#define PROPERTY_BACKGROUND "panel-applet-background" -#define PROPERTY_FLAGS "panel-applet-flags" -#define PROPERTY_SIZE_HINTS "panel-applet-size-hints" -#define PROPERTY_LOCKED_DOWN "panel-applet-locked-down" - enum { + PROPERTY_0, + PROPERTY_ID, + PROPERTY_CLOSURE, + PROPERTY_PREFS_KEY, PROPERTY_ORIENT_IDX, PROPERTY_SIZE_IDX, PROPERTY_BACKGROUND_IDX, PROPERTY_FLAGS_IDX, PROPERTY_SIZE_HINTS_IDX, - PROPERTY_LOCKED_DOWN_IDX + PROPERTY_LOCKED_DOWN_IDX, + /* Compatibility */ + PROPERTY_IID }; static void panel_applet_handle_background (PanelApplet *applet); @@ -250,6 +290,11 @@ applet->priv->prefs_key, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); + + if (g_hash_table_lookup (applet->priv->notifies, "prefs-key")) { + g_signal_emit (applet, panel_applet_signals [PROPERTY_CHANGED], + 0, "prefs-key"); + } } } @@ -267,45 +312,62 @@ { g_return_if_fail (PANEL_IS_APPLET (applet)); - if (applet->priv->prop_sack != NULL) - bonobo_pbclient_set_short (BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_FLAGS, flags, NULL); - else + if (applet->priv->flags != flags) { applet->priv->flags = flags; + + if (g_hash_table_lookup (applet->priv->notifies, "flags")) { + g_signal_emit (applet, panel_applet_signals [PROPERTY_CHANGED], + 0, "flags"); + } + } } void -panel_applet_set_size_hints (PanelApplet *applet, - const int *size_hints, - int n_elements, - int base_size) -{ - CORBA_sequence_CORBA_long *seq; - CORBA_Environment env; - CORBA_any any; - int i; - - CORBA_exception_init (&env); - - seq = CORBA_sequence_CORBA_long__alloc (); - seq->_length = seq->_maximum = n_elements; - seq->_release = CORBA_TRUE; - seq->_buffer = CORBA_sequence_CORBA_long_allocbuf (seq->_length); - - for (i = 0; i < n_elements; i++) - seq->_buffer [i] = size_hints [i] + base_size; - - any._type = TC_CORBA_sequence_CORBA_long; - any._release = CORBA_FALSE; - any._value = seq; - - Bonobo_PropertyBag_setValue (BONOBO_OBJREF (applet->priv->prop_sack), - PROPERTY_SIZE_HINTS, - &any, - &env); +panel_applet_set_size_hints (PanelApplet *applet, + const int *size_hints, + int n_elements, + int base_size) +{ + GArray *shints; + gint i, val; + gboolean notify = FALSE; + + g_return_if_fail (PANEL_IS_APPLET (applet)); + + if (!applet->priv->size_hints) + notify = TRUE; - CORBA_free (seq); + if (!notify && (n_elements != applet->priv->size_hints->len)) + notify = TRUE; + + shints = g_array_sized_new (FALSE, FALSE, sizeof (gint), + n_elements); + + for (i = 0; i < n_elements; i++) { + val = size_hints[i] + base_size; + g_array_append_val (shints, val); + + if (!notify && + (val != g_array_index (applet->priv->size_hints, gint, i))) + notify = TRUE; + } + + if (applet->priv->size_hints) + g_array_free (applet->priv->size_hints, TRUE); + applet->priv->size_hints = shints; + + if (notify && g_hash_table_lookup (applet->priv->notifies, "size-hints")) { + g_signal_emit (applet, panel_applet_signals [PROPERTY_CHANGED], + 0, "size-hints"); + } +} + +void +panel_applet_set_size (PanelApplet *applet, guint size) +{ + g_return_if_fail (PANEL_IS_APPLET (applet)); - CORBA_exception_free (&env); + applet->priv->size = size; } guint @@ -467,6 +529,182 @@ &xev); } +/* Compatibility */ +static void +popup_component_set_prop (BonoboUIComponent *component, + const char *path, + const char *prop, + const char *value, + CORBA_Environment *opt_ev) +{ + PanelApplet *applet = NULL; + GtkAction *action = NULL; + gchar *name = NULL; + gboolean val; + + applet = PANEL_APPLET (g_object_get_data (G_OBJECT (component), + "applet")); + g_assert (applet != NULL); + + if (!g_strrstr (path, "/commands")) + return; + + name = g_strrstr (path, "/") + 1; + action = panel_applet_menu_get_action (applet->priv->menu, + name); + if (!action) + return; + + val = (g_ascii_strcasecmp (value, "1") == 0); + + if (g_ascii_strcasecmp (prop, "hidden") == 0) { + gtk_action_set_visible (action, !val); + } else if (g_ascii_strcasecmp (prop, "sensitive") == 0) { + gtk_action_set_sensitive (action, val); + } else if (g_ascii_strcasecmp (prop, "state") == 0) { + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), + val); + } + + g_print ("DBG: set_prop: path: %s, prop: %s, value: %s\n", + path, prop, value); +} + +static gchar * +popup_component_get_prop (BonoboUIComponent *component, + const char *path, + const char *prop, + CORBA_Environment *opt_ev) +{ + PanelApplet *applet = NULL; + GtkAction *action = NULL; + gchar *name = NULL; + gboolean val = FALSE; + + applet = PANEL_APPLET (g_object_get_data (G_OBJECT (component), + "applet")); + g_assert (applet != NULL); + + if (!g_strrstr (path, "/commands")) + return NULL; + + name = g_strrstr (path, "/") + 1; + action = panel_applet_menu_get_action (applet->priv->menu, + name); + if (!action) + return NULL; + + if (g_ascii_strcasecmp (prop, "hidden") == 0) { + val = !gtk_action_get_visible (action); + } else if (g_ascii_strcasecmp (prop, "sensitive") == 0) { + val = gtk_action_get_sensitive (action); + } else if (g_ascii_strcasecmp (prop, "state") == 0) { + val = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + } else { + return NULL; + } + + g_print ("DBG: get_prop: path: %s, prop: %s\n", + path, prop); + + return val ? g_strdup ("1") : g_strdup ("0"); +} + +static GCallback +get_callback_from_verb_list (const BonoboUIVerb *verb_list, + const gchar *verb) +{ + const BonoboUIVerb *l; + + for (l = verb_list; l && l->cname; l++) { + if (g_ascii_strcasecmp (l->cname, verb) == 0) + return (l->cb) ? G_CALLBACK (l->cb) : NULL; + } + + return NULL; +} + +static void +panel_applet_setup_menu_from_ui_component (PanelApplet *applet, + BonoboUIComponent *component, + const BonoboUIVerb *verb_list, + gpointer user_data) +{ + BonoboUINode *root, *child, *node; + GtkActionEntry *entries; + GArray *actions; + GString *ui; + gchar *ui_xml; + gint i; + + ui = g_string_new ("\n\n"); + actions = g_array_new (FALSE, TRUE, sizeof (gchar **)); + + root = bonobo_ui_component_get_tree (component, "/popups/popup", TRUE, NULL); + child = bonobo_ui_node_children (root); + + for (node = child; node; node = bonobo_ui_node_next (node)) { + const gchar *item = bonobo_ui_node_get_name (node); + gchar **entry; + gchar *name, *action; + gchar *label, *icon; + + if (g_ascii_strcasecmp (item, "menuitem") == 0) { + name = bonobo_ui_node_get_attr (node, "name"); + action = bonobo_ui_node_get_attr (node, "verb"); + label = bonobo_ui_node_get_attr (node, "label"); + icon = bonobo_ui_node_get_attr (node, "pixname"); + + entry = g_new0 (gchar *, 4); + entry[0] = action ? action : g_strdup (""); + entry[1] = label ? label : g_strdup (""); + entry[2] = icon ? icon : g_strdup (""); + entry[3] = NULL; + + g_array_append_val (actions, entry); + g_string_append_printf (ui, "\n", + name, action); + + g_free (name); + } else if (g_ascii_strcasecmp (item, "separator") == 0) { + ui = g_string_append (ui, "\n"); + } + + /*g_print ("DBG: name: %s\n", bonobo_ui_node_get_name (node)); + g_print ("name: %s, verb: %s, label: %s\n", + bonobo_ui_node_get_attr (node, "name"), + bonobo_ui_node_get_attr (node, "verb"), + bonobo_ui_node_get_attr (node, "label"));*/ + } + + ui = g_string_append (ui, "\n\n"); + ui_xml = g_string_free (ui, FALSE); + entries = g_new0 (GtkActionEntry, actions->len); + + for (i = 0; i < actions->len; i++) { + gchar **entry = g_array_index (actions, gchar **, i); + + entries[i].name = entry[0]; + entries[i].label = entry[1]; + entries[i].accelerator = NULL; + entries[i].stock_id = entry[2]; + entries[i].callback = get_callback_from_verb_list (verb_list, entry[0]); + } + + panel_applet_menu_add_actions (applet->priv->menu, + entries, actions->len, + user_data); + panel_applet_menu_add_ui_from_string (applet->priv->menu, ui_xml); + + g_free (ui_xml); + + for (i = 0; i < actions->len; i++) + g_strfreev (g_array_index (actions, gchar **, i)); + + g_array_free (actions, TRUE); +} + +/* Compatibility */ void panel_applet_setup_menu (PanelApplet *applet, const gchar *xml, @@ -474,21 +712,31 @@ gpointer user_data) { BonoboUIComponent *popup_component; - + g_return_if_fail (PANEL_IS_APPLET (applet)); g_return_if_fail (xml != NULL && verb_list != NULL); + g_print ("DBG: panel_applet_setup_menu\n"); + popup_component = panel_applet_get_popup_component (applet); + g_object_set_data (G_OBJECT (popup_component), + "applet", applet); bonobo_ui_component_set (popup_component, "/", "", NULL); bonobo_ui_component_set_translate (popup_component, "/popups", xml, NULL); - bonobo_ui_component_add_verb_list_with_data (popup_component, verb_list, user_data); +/* bonobo_ui_component_add_verb_list_with_data (popup_component, verb_list, user_data);*/ + + panel_applet_setup_menu_from_ui_component (applet, popup_component, verb_list, user_data); + + BONOBO_UI_COMPONENT_CLASS (G_OBJECT_GET_CLASS (popup_component))->set_prop = popup_component_set_prop; + BONOBO_UI_COMPONENT_CLASS (G_OBJECT_GET_CLASS (popup_component))->get_prop = popup_component_get_prop; } +/* Compatibility */ void -panel_applet_setup_menu_from_file (PanelApplet *applet, +panel_applet_setup_menu_from_file (PanelApplet *applet, const gchar *opt_datadir, const gchar *file, const gchar *opt_app_name, @@ -501,6 +749,8 @@ g_return_if_fail (PANEL_IS_APPLET (applet)); g_return_if_fail (file != NULL && verb_list != NULL); + g_print ("DBG: panel_applet_setup_menu_from_file\n"); + if (!opt_datadir) opt_datadir = PANEL_APPLET_DATADIR; @@ -509,29 +759,32 @@ (unsigned long) getpid ()); popup_component = panel_applet_get_popup_component (applet); + g_object_set_data (G_OBJECT (popup_component), + "applet", applet); bonobo_ui_util_set_ui (popup_component, opt_datadir, file, opt_app_name, NULL); + + panel_applet_setup_menu_from_ui_component (applet, popup_component, verb_list, user_data); - bonobo_ui_component_add_verb_list_with_data (popup_component, verb_list, user_data); - - if (app_name) - g_free (app_name); + BONOBO_UI_COMPONENT_CLASS (G_OBJECT_GET_CLASS (popup_component))->set_prop = popup_component_set_prop; + BONOBO_UI_COMPONENT_CLASS (G_OBJECT_GET_CLASS (popup_component))->get_prop = popup_component_get_prop; } -BonoboControl * -panel_applet_get_control (PanelApplet *applet) +/* Compatibility */ +BonoboUIComponent * +panel_applet_get_popup_component (PanelApplet *applet) { g_return_val_if_fail (PANEL_IS_APPLET (applet), NULL); - return applet->priv->control; + return bonobo_control_get_popup_ui_component (applet->priv->control); } -BonoboUIComponent * -panel_applet_get_popup_component (PanelApplet *applet) +PanelAppletMenu * +panel_applet_get_menu (PanelApplet *applet) { g_return_val_if_fail (PANEL_IS_APPLET (applet), NULL); - return bonobo_control_get_popup_ui_component (applet->priv->control); + return applet->priv->menu; } static void @@ -545,20 +798,39 @@ g_object_unref (applet->priv->client); applet->priv->client = NULL; - if (applet->priv->prop_sack) - bonobo_object_unref ( - BONOBO_OBJECT (applet->priv->prop_sack)); - applet->priv->prop_sack = NULL; - - g_free (applet->priv->size_hints); + if (applet->priv->size_hints) + g_array_free (applet->priv->size_hints, TRUE); + applet->priv->size_hints = NULL; + g_free (applet->priv->prefs_key); g_free (applet->priv->background); - g_free (applet->priv->iid); - + g_free (applet->priv->id); + + if (applet->priv->notifies) + g_hash_table_destroy (applet->priv->notifies); + applet->priv->notifies = NULL; + if (applet->priv->closure) g_closure_unref (applet->priv->closure); applet->priv->closure = NULL; + if (applet->priv->menu) + g_object_unref (applet->priv->menu); + applet->priv->menu = NULL; + + + /* Compatibility */ + if (applet->priv->iid) + g_free (applet->priv->iid); + applet->priv->iid = NULL; + if (applet->priv->control) + bonobo_object_unref (applet->priv->control); + applet->priv->control = NULL; + + if (applet->priv->popup_component) + bonobo_object_unref (applet->priv->popup_component); + applet->priv->popup_component = NULL; + parent_class->finalize (object); } @@ -602,11 +874,11 @@ int pointer_x; int pointer_y; - g_return_if_fail (PANEL_IS_APPLET (widget)); + g_assert (PANEL_IS_APPLET (widget)); applet = PANEL_APPLET (widget); - screen = gtk_widget_get_screen (widget); + screen = gtk_window_get_screen (GTK_WINDOW (applet->priv->plug)); gtk_widget_size_request (GTK_WIDGET (menu), &requisition); @@ -637,7 +909,6 @@ menu_x -= requisition.width; else menu_x += widget->allocation.width; - } *x = menu_x; @@ -661,6 +932,80 @@ return !container_has_focusable_child (GTK_CONTAINER (widget)); } +/* Taken from libbonoboui */ +static gboolean +panel_applet_forward_button_events (GtkWidget *widget, + GdkEventButton *event) +{ + XEvent xevent; + + if (!GTK_WIDGET_TOPLEVEL (widget)) + return FALSE; + + if (event->type == GDK_BUTTON_PRESS) { + xevent.xbutton.type = ButtonPress; + + /* X does an automatic pointer grab on button press + * if we have both button press and release events + * selected. + * We don't want to hog the pointer on our parent. + */ + gdk_display_pointer_ungrab + (gtk_widget_get_display (widget), + GDK_CURRENT_TIME); + } else { + xevent.xbutton.type = ButtonRelease; + } + + xevent.xbutton.display = GDK_WINDOW_XDISPLAY (widget->window); + xevent.xbutton.window = GDK_WINDOW_XWINDOW (GTK_PLUG (widget)->socket_window); + xevent.xbutton.root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window + (gdk_drawable_get_screen (widget->window))); + /* + * FIXME: the following might cause + * big problems for non-GTK apps + */ + xevent.xbutton.x = 0; + xevent.xbutton.y = 0; + xevent.xbutton.x_root = 0; + xevent.xbutton.y_root = 0; + xevent.xbutton.state = event->state; + xevent.xbutton.button = event->button; + xevent.xbutton.same_screen = TRUE; /* FIXME ? */ + + gdk_error_trap_push (); + + XSendEvent (GDK_WINDOW_XDISPLAY (widget->window), + GDK_WINDOW_XWINDOW (GTK_PLUG (widget)->socket_window), + False, NoEventMask, &xevent); + + gdk_flush (); + gdk_error_trap_pop (); + + return TRUE; +} + +static gboolean +panel_applet_popup_menu_full (PanelApplet *applet, + GtkMenuPositionFunc position_func, + gpointer user_data, + guint button, + guint32 time) +{ + GtkWidget *popup; + + popup = panel_applet_menu_get_popup (applet->priv->menu); + if (popup) { + gtk_menu_popup (GTK_MENU (popup), NULL, NULL, + position_func, + user_data, + button, time); + return TRUE; + } + + return FALSE; +} + static gboolean panel_applet_button_press (GtkWidget *widget, GdkEventButton *event) @@ -674,37 +1019,30 @@ } } - if (event->button == 1) - return TRUE; - else if (event->button == 3) { - bonobo_control_do_popup_full ( - applet->priv->control, - NULL, NULL, - (GtkMenuPositionFunc) panel_applet_position_menu, - applet, - event->button, - event->time); + if (event->button == 1) { + return panel_applet_forward_button_events (applet->priv->plug, event); + } else if (event->button == 3) { + if (!panel_applet_popup_menu_full (applet, + (GtkMenuPositionFunc) panel_applet_position_menu, + applet, + event->button, + event->time)) { + return panel_applet_forward_button_events (applet->priv->plug, event); + } + return TRUE; } - return FALSE; -} - -gboolean -_panel_applet_popup_menu (PanelApplet *applet, - guint button, - guint32 time) -{ - bonobo_control_do_popup_full (applet->priv->control, NULL, NULL, - (GtkMenuPositionFunc) panel_applet_position_menu, - applet, button, time); - return TRUE; + return panel_applet_forward_button_events (applet->priv->plug, event); } static gboolean -panel_applet_popup_menu (PanelApplet *applet) +panel_applet_button_release (GtkWidget *widget, + GdkEventButton *event) { - return _panel_applet_popup_menu (applet, 3, GDK_CURRENT_TIME); + PanelApplet *applet = PANEL_APPLET (widget); + + return panel_applet_forward_button_events (applet->priv->plug, event); } static void @@ -834,7 +1172,8 @@ GtkWidget *previous_focus_child; PanelApplet *applet; - g_return_val_if_fail (PANEL_IS_APPLET (widget), FALSE); + if (!PANEL_IS_APPLET (widget)) + return FALSE; applet = PANEL_APPLET (widget); if (applet->priv->moving_focus_out) { @@ -903,10 +1242,10 @@ char **elements; char *tmp; - g_return_val_if_fail (str != NULL, FALSE); - g_return_val_if_fail (xid != NULL, FALSE); - g_return_val_if_fail (x != NULL, FALSE); - g_return_val_if_fail (y != NULL, FALSE); + g_assert (str != NULL); + g_assert (xid != NULL); + g_assert (x != NULL); + g_assert (y != NULL); elements = g_strsplit (str, ",", -1); @@ -955,7 +1294,8 @@ cairo_pattern_t *pattern; cairo_matrix_t matrix; - g_return_val_if_fail (PANEL_IS_APPLET (applet), NULL); + if (!PANEL_IS_APPLET (applet)) + return NULL; if (!GTK_WIDGET_REALIZED (applet)) return NULL; @@ -1093,47 +1433,69 @@ } static void -panel_applet_get_prop (BonoboPropertyBag *sack, - BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) +panel_applet_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - PanelApplet *applet = PANEL_APPLET (user_data); + PanelApplet *applet = PANEL_APPLET (object); - switch (arg_id) { + switch (prop_id) { + case PROPERTY_ID: + g_value_set_string (value, applet->priv->id); + break; + case PROPERTY_CLOSURE: + g_value_set_pointer (value, applet->priv->closure); + break; + case PROPERTY_PREFS_KEY: + g_value_set_string (value, applet->priv->prefs_key); + break; case PROPERTY_ORIENT_IDX: - BONOBO_ARG_SET_SHORT (arg, applet->priv->orient); + g_value_set_uint (value, applet->priv->orient); break; case PROPERTY_SIZE_IDX: - BONOBO_ARG_SET_SHORT (arg, applet->priv->size); + g_value_set_uint (value, applet->priv->size); break; case PROPERTY_BACKGROUND_IDX: - BONOBO_ARG_SET_STRING (arg, applet->priv->background); + g_value_set_string (value, applet->priv->background); break; case PROPERTY_FLAGS_IDX: - BONOBO_ARG_SET_SHORT (arg, applet->priv->flags); + g_value_set_uint (value, applet->priv->flags); break; case PROPERTY_SIZE_HINTS_IDX: { - CORBA_sequence_CORBA_long *seq; - int i; + GValueArray *varray; + gint i; + + if (!applet->priv->size_hints) { + GValue val = {0, }; - seq = arg->_value; + g_value_init (&val, G_TYPE_INT); + g_value_set_int (&val, -1); + varray = g_value_array_new (1); + g_value_array_append (varray, &val); + g_value_unset (&val); + } else { + varray = g_value_array_new (applet->priv->size_hints->len); + + for (i = 0; i < applet->priv->size_hints->len; i++) { + GValue val = {0, }; + + g_value_init (&val, G_TYPE_INT); + g_value_set_int (&val, g_array_index (applet->priv->size_hints, + gint, i)); + g_value_array_append (varray, &val); + g_value_unset (&val); + } + } - seq->_length = seq->_maximum = applet->priv->size_hints_len; - seq->_buffer = CORBA_sequence_CORBA_long_allocbuf (seq->_length); - seq->_release = CORBA_TRUE; - - for (i = 0; i < applet->priv->size_hints_len; i++) - seq->_buffer [i] = applet->priv->size_hints [i]; + g_value_take_boxed (value, varray); } break; case PROPERTY_LOCKED_DOWN_IDX: - BONOBO_ARG_SET_BOOLEAN (arg, applet->priv->locked_down); + g_value_set_boolean (value, applet->priv->locked_down); break; default: - g_assert_not_reached (); - break; + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } } @@ -1207,25 +1569,48 @@ g_assert_not_reached (); break; } + + if (g_hash_table_lookup (applet->priv->notifies, "background")) { + g_signal_emit (applet, panel_applet_signals [PROPERTY_CHANGED], + 0, "background"); + } } static void -panel_applet_set_prop (BonoboPropertyBag *sack, - const BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) +panel_applet_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { - PanelApplet *applet = PANEL_APPLET (user_data); - - switch (arg_id) { + PanelApplet *applet = PANEL_APPLET (object); + gboolean notify = FALSE; + + switch (prop_id) { + case PROPERTY_ID: + if (!applet->priv->id) { + applet->priv->id = g_value_dup_string (value); + } + break; + case PROPERTY_CLOSURE: + if (!applet->priv->closure) { + applet->priv->closure = g_value_get_pointer (value); + g_closure_set_marshal (applet->priv->closure, + panel_applet_marshal_BOOLEAN__STRING); + } + + break; + case PROPERTY_PREFS_KEY: + panel_applet_set_preferences_key (applet, + g_value_get_string (value)); + break; case PROPERTY_ORIENT_IDX: { PanelAppletOrient orient; - orient = BONOBO_ARG_GET_SHORT (arg); + orient = g_value_get_uint (value); if (applet->priv->orient != orient) { applet->priv->orient = orient; + notify = TRUE; g_signal_emit (G_OBJECT (applet), panel_applet_signals [CHANGE_ORIENT], @@ -1236,10 +1621,11 @@ case PROPERTY_SIZE_IDX: { guint size; - size = BONOBO_ARG_GET_SHORT (arg); + size = g_value_get_uint (value); if (applet->priv->size != size) { applet->priv->size = size; + notify = TRUE; g_signal_emit (G_OBJECT (applet), panel_applet_signals [CHANGE_SIZE], @@ -1251,92 +1637,81 @@ if (applet->priv->background) g_free (applet->priv->background); - applet->priv->background = g_strdup (BONOBO_ARG_GET_STRING (arg)); + applet->priv->background = g_value_dup_string (value); panel_applet_handle_background (applet); break; - case PROPERTY_FLAGS_IDX: - applet->priv->flags = BONOBO_ARG_GET_SHORT (arg); + case PROPERTY_FLAGS_IDX: { + guint flags; + + flags = g_value_get_uint (value); + + if (applet->priv->flags != flags) { + applet->priv->flags = flags; + notify = TRUE; + } + } break; case PROPERTY_SIZE_HINTS_IDX: { - CORBA_sequence_CORBA_long *seq = arg->_value; - int i; - - applet->priv->size_hints = g_realloc (applet->priv->size_hints, - seq->_length * sizeof (int)); - for (i = 0; i < seq->_length; i++) - applet->priv->size_hints [i] = seq->_buffer [i]; + GValueArray *varray; + GArray *size_hints; + gint i, val; - applet->priv->size_hints_len = seq->_length;; + if (!applet->priv->size_hints) + notify = TRUE; + + varray = g_value_get_boxed (value); + + if (varray) { + if (!notify && + (varray->n_values != applet->priv->size_hints->len)) + notify = TRUE; + + size_hints = g_array_sized_new (FALSE, FALSE, + sizeof (gint), + varray->n_values); + + for (i = 0; i < varray->n_values; i++) { + val = g_value_get_int (g_value_array_get_nth (varray, i)); + g_array_append_val (size_hints, val); + + if (!notify && + (val != g_array_index (applet->priv->size_hints, gint, i))) + notify = TRUE; + } + + if (applet->priv->size_hints) + g_array_free (applet->priv->size_hints, TRUE); + applet->priv->size_hints = size_hints; + } } break; - case PROPERTY_LOCKED_DOWN_IDX: - applet->priv->locked_down = BONOBO_ARG_GET_BOOLEAN (arg); + case PROPERTY_LOCKED_DOWN_IDX: { + gboolean locked_down; + + locked_down = g_value_get_boolean (value); + + if (applet->priv->locked_down != locked_down) { + applet->priv->locked_down = locked_down; + notify = TRUE; + } + } break; - default: - g_assert_not_reached (); + + /* Compatibility */ + case PROPERTY_IID: + if (!applet->priv->iid) { + applet->priv->iid = g_value_dup_string (value); + } break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } -} -static BonoboPropertyBag * -panel_applet_property_bag (PanelApplet *applet) -{ - BonoboPropertyBag *sack; - - sack = bonobo_property_bag_new (panel_applet_get_prop, - panel_applet_set_prop, - applet); - - bonobo_property_bag_add (sack, - PROPERTY_ORIENT, - PROPERTY_ORIENT_IDX, - BONOBO_ARG_SHORT, - NULL, - _("The Applet's containing Panel's orientation"), - Bonobo_PROPERTY_READABLE | Bonobo_PROPERTY_WRITEABLE); - - bonobo_property_bag_add (sack, - PROPERTY_SIZE, - PROPERTY_SIZE_IDX, - BONOBO_ARG_SHORT, - NULL, - _("The Applet's containing Panel's size in pixels"), - Bonobo_PROPERTY_READABLE | Bonobo_PROPERTY_WRITEABLE); - - bonobo_property_bag_add (sack, - PROPERTY_BACKGROUND, - PROPERTY_BACKGROUND_IDX, - BONOBO_ARG_STRING, - NULL, - _("The Applet's containing Panel's background color or pixmap"), - Bonobo_PROPERTY_READABLE | Bonobo_PROPERTY_WRITEABLE); - - bonobo_property_bag_add (sack, - PROPERTY_FLAGS, - PROPERTY_FLAGS_IDX, - BONOBO_ARG_SHORT, - NULL, - _("The Applet's flags"), - Bonobo_PROPERTY_READABLE); - - bonobo_property_bag_add (sack, - PROPERTY_SIZE_HINTS, - PROPERTY_SIZE_HINTS_IDX, - TC_CORBA_sequence_CORBA_long, - NULL, - _("Ranges that hint what sizes are acceptable for the applet"), - Bonobo_PROPERTY_READABLE); - - bonobo_property_bag_add (sack, - PROPERTY_LOCKED_DOWN, - PROPERTY_LOCKED_DOWN_IDX, - BONOBO_ARG_BOOLEAN, - NULL, - _("The Applet's containing Panel is locked down"), - Bonobo_PROPERTY_READABLE | Bonobo_PROPERTY_WRITEABLE); - - return sack; + if (notify && g_hash_table_lookup (applet->priv->notifies, pspec->name)) { + g_signal_emit (applet, panel_applet_signals [PROPERTY_CHANGED], + 0, pspec->name); + } } static void @@ -1349,134 +1724,65 @@ } static void -panel_applet_control_bound (BonoboControl *control, - PanelApplet *applet) +panel_applet_embedded (PanelApplet *applet, + gpointer user_data) { + GValue value = {0, }; + GArray *params; + gint i; gboolean ret; + gchar *id; - g_return_if_fail (PANEL_IS_APPLET (applet)); - g_return_if_fail (applet->priv->iid != NULL && - applet->priv->closure != NULL); + g_assert (PANEL_IS_APPLET (applet)); + g_assert (applet->priv->id != NULL && + applet->priv->closure != NULL); - if (applet->priv->bound) + if (applet->priv->embedded) return; - bonobo_closure_invoke (applet->priv->closure, - G_TYPE_BOOLEAN, &ret, - PANEL_TYPE_APPLET, applet, - G_TYPE_STRING, applet->priv->iid, - NULL); + /* Compatibility */ + g_print ("DBG: iid: %s\n", applet->priv->iid); + if (applet->priv->iid) + id = applet->priv->iid; + else + id = applet->priv->id; + g_print ("DBG: send id: %s\n", id); + + params = g_array_sized_new (FALSE, TRUE, sizeof (GValue), 2); - if (!ret) { /* FIXME */ - g_warning ("need to free the control here"); + value.g_type = 0; + g_value_init (&value, G_TYPE_OBJECT); + g_value_set_object (&value, G_OBJECT (applet)); + g_array_append_val (params, value); + + value.g_type = 0; + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, id); + g_array_append_val (params, value); + + value.g_type = 0; + g_value_init (&value, G_TYPE_BOOLEAN); + + g_closure_invoke (applet->priv->closure, + &value, params->len, + (GValue *) params->data, + NULL); + + for (i = 0; i < params->len; i++) + g_value_unset (&g_array_index (params, GValue, i)); - return; - } + g_array_free (params, TRUE); - applet->priv->bound = TRUE; -} + ret = g_value_get_boolean (&value); + g_value_unset (&value); -static Bonobo_Unknown -panel_applet_item_handler_get_object (BonoboItemHandler *handler, - const char *item_name, - gboolean only_if_exists, - gpointer user_data, - CORBA_Environment *ev) -{ - PanelApplet *applet = user_data; - GSList *options; - GSList *l; - - g_return_val_if_fail (PANEL_IS_APPLET (applet), CORBA_OBJECT_NIL); - - options = bonobo_item_option_parse (item_name); - - for (l = options; l; l = l->next) { - BonoboItemOption *option = l->data; - - if (!option->value || !option->value [0]) - continue; - - if (!strcmp (option->key, "prefs_key") && !applet->priv->prefs_key) - panel_applet_set_preferences_key (applet, option->value); - - else if (!strcmp (option->key, "background")) - bonobo_pbclient_set_string (BONOBO_OBJREF (applet->priv->prop_sack), - PROPERTY_BACKGROUND, option->value, NULL); - - else if (!strcmp (option->key, "orient")) { - if (!strcmp (option->value, "up")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_ORIENT, - PANEL_APPLET_ORIENT_UP, NULL); - - else if (!strcmp (option->value, "down")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_ORIENT, - PANEL_APPLET_ORIENT_DOWN, NULL); - - else if (!strcmp (option->value, "left")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_ORIENT, - PANEL_APPLET_ORIENT_LEFT, NULL); - - else if (!strcmp (option->value, "right")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_ORIENT, - PANEL_APPLET_ORIENT_RIGHT, NULL); - - } else if (!strcmp (option->key, "size")) { - if (!strcmp (option->value, "xx-small")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_SIZE, - GNOME_Vertigo_PANEL_XX_SMALL, NULL); - - else if (!strcmp (option->value, "x-small")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_SIZE, - GNOME_Vertigo_PANEL_X_SMALL, NULL); - - else if (!strcmp (option->value, "small")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_SIZE, - GNOME_Vertigo_PANEL_SMALL, NULL); - - else if (!strcmp (option->value, "medium")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_SIZE, - GNOME_Vertigo_PANEL_MEDIUM, NULL); - - else if (!strcmp (option->value, "large")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_SIZE, - GNOME_Vertigo_PANEL_LARGE, NULL); - - else if (!strcmp (option->value, "x-large")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_SIZE, - GNOME_Vertigo_PANEL_X_LARGE, NULL); - - else if (!strcmp (option->value, "xx-large")) - bonobo_pbclient_set_short ( - BONOBO_OBJREF (applet->priv->prop_sack), PROPERTY_SIZE, - GNOME_Vertigo_PANEL_XX_LARGE, NULL); - } else if (!strcmp (option->key, "locked_down")) { - gboolean val = FALSE; - if (option->value[0] == 'T' || - option->value[0] == 't' || - option->value[0] == 'Y' || - option->value[0] == 'y' || - atoi (option->value) != 0) - val = TRUE; - bonobo_pbclient_set_boolean (BONOBO_OBJREF (applet->priv->prop_sack), - PROPERTY_LOCKED_DOWN, val, NULL); - } + if (!ret) { + /* FIXME: */ + return; } - bonobo_item_options_free (options); - - return bonobo_object_dup_ref (BONOBO_OBJREF (applet->priv->control), ev); + applet->priv->embedded = TRUE; } static void @@ -1519,16 +1825,99 @@ klass->move_focus_out_of_applet = panel_applet_move_focus_out_of_applet; widget_class->button_press_event = panel_applet_button_press; + widget_class->button_release_event = panel_applet_button_release; widget_class->size_request = panel_applet_size_request; widget_class->size_allocate = panel_applet_size_allocate; widget_class->expose_event = panel_applet_expose; widget_class->focus = panel_applet_focus; widget_class->realize = panel_applet_realize; + gobject_class->set_property = panel_applet_set_property; + gobject_class->get_property = panel_applet_get_property; gobject_class->finalize = panel_applet_finalize; g_type_class_add_private (klass, sizeof (PanelAppletPrivate)); + g_object_class_install_property (gobject_class, + PROPERTY_ID, + g_param_spec_string ("id", + "ID", + "The Applet identifier", + NULL, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROPERTY_CLOSURE, + g_param_spec_pointer ("closure", + "GClocure", + "The Applet closure", + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROPERTY_PREFS_KEY, + g_param_spec_string ("prefs-key", + "PrefsKey", + "The Applet gconf preferences key", + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROPERTY_ORIENT_IDX, + g_param_spec_uint ("orient", + "Orient", + "The Applet's containing Panel's orientation", + PANEL_APPLET_ORIENT_UP, + PANEL_APPLET_ORIENT_LEFT, + PANEL_APPLET_ORIENT_UP, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROPERTY_SIZE_IDX, + g_param_spec_uint ("size", + "Size", + "The Applet's containing Panel's size in pixels", + 0, + G_MAXUINT, + 0, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROPERTY_SIZE_HINTS_IDX, + g_param_spec_value_array ("size-hints", + "SizeHints", + "Ranges that hint what sizes are acceptable for the applet", + g_param_spec_int ("hints", NULL, NULL, + 0, G_MAXINT, 0, + G_PARAM_READWRITE), + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROPERTY_BACKGROUND_IDX, + g_param_spec_string ("background", + "Background", + "The Applet's containing Panel's background color or pixmap", + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROPERTY_FLAGS_IDX, + g_param_spec_uint ("flags", + "Flags", + "The Applet's flags", + PANEL_APPLET_FLAGS_NONE, + PANEL_APPLET_HAS_HANDLE, + PANEL_APPLET_FLAGS_NONE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROPERTY_LOCKED_DOWN_IDX, + g_param_spec_boolean ("locked-down", + "Locked Down", + "The Applet's containing Panel is locked down", + FALSE, + G_PARAM_READWRITE)); + /* Compatibility */ + g_object_class_install_property (gobject_class, + PROPERTY_IID, + g_param_spec_string ("iid", + "IID", + "The Applet identifier (only bonobo)", + NULL, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); + + panel_applet_signals [CHANGE_ORIENT] = g_signal_new ("change_orient", G_TYPE_FROM_CLASS (klass), @@ -1578,6 +1967,21 @@ G_TYPE_NONE, 1, GTK_TYPE_DIRECTION_TYPE); + + panel_applet_signals [PROPERTY_CHANGED] = + g_signal_new ("property_changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, + 0, + NULL, + NULL, + panel_applet_marshal_VOID__STRING, + G_TYPE_NONE, + 1, + G_TYPE_STRING); + + dbus_g_object_type_install_info (PANEL_TYPE_APPLET, + &dbus_glib_panel_applet_object_info); binding_set = gtk_binding_set_by_class (object_class); add_tab_bindings (binding_set, 0, GTK_DIR_TAB_FORWARD); @@ -1592,17 +1996,45 @@ { applet->priv = PANEL_APPLET_GET_PRIVATE (applet); + applet->priv->plug = gtk_plug_new (0); + g_signal_connect_swapped (G_OBJECT (applet->priv->plug), "embedded", + G_CALLBACK (panel_applet_embedded), + applet); + + applet->priv->menu = panel_applet_menu_new (); + applet->priv->applet = NULL; + applet->priv->xid = 0; + applet->priv->client = gconf_client_get_default (); - applet->priv->bound = FALSE; - applet->priv->flags = PANEL_APPLET_FLAGS_NONE; + applet->priv->embedded = FALSE; + applet->priv->flags = PANEL_APPLET_FLAGS_NONE; applet->priv->orient = PANEL_APPLET_ORIENT_UP; - applet->priv->size = GNOME_Vertigo_PANEL_MEDIUM; + applet->priv->size = 24; + applet->priv->size_hints = NULL; + + applet->priv->notifies = g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, NULL); applet->priv->moving_focus_out = FALSE; gtk_widget_set_events (GTK_WIDGET (applet), GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); + + gtk_container_add (GTK_CONTAINER (applet->priv->plug), GTK_WIDGET (applet)); + gtk_widget_show (applet->priv->plug); + + if (GTK_WIDGET_REALIZED (applet->priv->plug)) + applet->priv->xid = GDK_WINDOW_XID (applet->priv->plug->window); + else + applet->priv->xid = 0; + + /* Compatibility */ + applet->priv->dummy = gtk_label_new (NULL); + applet->priv->control = bonobo_control_new (GTK_WIDGET (applet->priv->dummy)); + applet->priv->popup_component = NULL; + } GType @@ -1631,39 +2063,12 @@ return type; } -static void +/* Compatibility */ +/*static void panel_applet_setup (PanelApplet *applet) { - PanelAppletPrivate *priv; - - priv = applet->priv; - - priv->control = bonobo_control_new (GTK_WIDGET (applet)); - - g_signal_connect (priv->control, "set_frame", - G_CALLBACK (panel_applet_control_bound), - applet); - - priv->prop_sack = panel_applet_property_bag (applet); - - bonobo_control_set_properties ( - priv->control, BONOBO_OBJREF (priv->prop_sack), NULL); - - priv->shell = panel_applet_shell_new (applet); - - bonobo_object_add_interface (BONOBO_OBJECT (priv->control), - BONOBO_OBJECT (priv->shell)); - - priv->item_handler = - bonobo_item_handler_new ( - NULL, panel_applet_item_handler_get_object, applet); - - bonobo_object_add_interface (BONOBO_OBJECT (priv->control), - BONOBO_OBJECT (priv->item_handler)); - - g_signal_connect (applet, "popup_menu", - G_CALLBACK (panel_applet_popup_menu), NULL); -} + applet->priv->control = bonobo_control_new (GTK_WIDGET (applet)); +}*/ GtkWidget * panel_applet_new (void) @@ -1672,161 +2077,51 @@ applet = g_object_new (PANEL_TYPE_APPLET, NULL); - panel_applet_setup (applet); + /* Compatibility */ + //panel_applet_setup (applet); return GTK_WIDGET (applet); } -typedef struct { - GType applet_type; - GClosure *closure; -} PanelAppletCallBackData; - -static PanelAppletCallBackData * -panel_applet_callback_data_new (GType applet_type, - GClosure *closure) -{ - PanelAppletCallBackData *retval; - - retval = g_new0 (PanelAppletCallBackData, 1); - - retval->applet_type = applet_type; - retval->closure = closure; - - return retval; -} - -static void -panel_applet_callback_data_free (PanelAppletCallBackData *data) -{ - g_closure_unref (data->closure); - g_free (data); -} - -static BonoboObject * -panel_applet_factory_callback (BonoboGenericFactory *factory, - const char *iid, - PanelAppletCallBackData *data) -{ - PanelApplet *applet; - - applet = g_object_new (data->applet_type, NULL); - - panel_applet_setup (applet); - - applet->priv->iid = g_strdup (iid); - applet->priv->closure = g_closure_ref (data->closure); - - bonobo_control_life_instrument (applet->priv->control); - - return BONOBO_OBJECT (applet->priv->control); -} - -static void -panel_applet_all_controls_dead (void) -{ - if (!bonobo_control_life_get_count()) - bonobo_main_quit (); -} - -int -panel_applet_factory_main_closure (const gchar *iid, - GType applet_type, - GClosure *closure) -{ - int retval; - char *display_iid; - PanelAppletCallBackData *data; - - g_return_val_if_fail (iid != NULL, 1); - g_return_val_if_fail (closure != NULL, 1); - - g_assert (g_type_is_a (applet_type, PANEL_TYPE_APPLET)); - - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - - bonobo_control_life_set_callback (panel_applet_all_controls_dead); - - closure = bonobo_closure_store (closure, panel_applet_marshal_BOOLEAN__STRING); - - data = panel_applet_callback_data_new (applet_type, closure); - - display_iid = bonobo_activation_make_registration_id ( - iid, DisplayString (gdk_display)); - retval = bonobo_generic_factory_main ( - display_iid, - (BonoboFactoryCallback) panel_applet_factory_callback, - data); - g_free (display_iid); - - panel_applet_callback_data_free (data); - - return retval; -} - -int -panel_applet_factory_main (const gchar *iid, - GType applet_type, - PanelAppletFactoryCallback callback, - gpointer data) +static gboolean +panel_applet_get_xid (PanelApplet *applet, gint IN_screen, guint32 *OUT_xid, GError **error) { - GClosure *closure; + GdkScreen *screen; - g_return_val_if_fail (iid != NULL, 1); - g_return_val_if_fail (callback != NULL, 1); + if (IN_screen != -1) + screen = gdk_display_get_screen ( + gdk_display_get_default (), IN_screen); + else + screen = gdk_screen_get_default (); - closure = g_cclosure_new (G_CALLBACK (callback), data, NULL); + gtk_window_set_screen (GTK_WINDOW (applet->priv->plug), screen); + gtk_widget_show (applet->priv->plug); + + *OUT_xid = applet->priv->xid; - return panel_applet_factory_main_closure (iid, applet_type, closure); + return TRUE; } -Bonobo_Unknown -panel_applet_shlib_factory_closure (const char *iid, - GType applet_type, - PortableServer_POA poa, - gpointer impl_ptr, - GClosure *closure, - CORBA_Environment *ev) +static gboolean +panel_applet_popup_menu (PanelApplet *applet, guint IN_button, guint32 IN_time, GError **error) { - BonoboShlibFactory *factory; - - g_return_val_if_fail (iid != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (closure != NULL, CORBA_OBJECT_NIL); - - g_assert (g_type_is_a (applet_type, PANEL_TYPE_APPLET)); - - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - - closure = bonobo_closure_store (closure, panel_applet_marshal_BOOLEAN__STRING); - - factory = bonobo_shlib_factory_new_closure ( - iid, poa, impl_ptr, - g_cclosure_new (G_CALLBACK (panel_applet_factory_callback), - panel_applet_callback_data_new (applet_type, closure), - (GClosureNotify) panel_applet_callback_data_free)); + panel_applet_popup_menu_full (applet, + (GtkMenuPositionFunc) panel_applet_position_menu, + applet, + IN_button, + IN_time); - return CORBA_Object_duplicate (BONOBO_OBJREF (factory), ev); + return TRUE; } -Bonobo_Unknown -panel_applet_shlib_factory (const char *iid, - GType applet_type, - PortableServer_POA poa, - gpointer impl_ptr, - PanelAppletFactoryCallback callback, - gpointer user_data, - CORBA_Environment *ev) +static gboolean +panel_applet_notify_add (PanelApplet *applet, const gchar *IN_property, GError **error) { - g_return_val_if_fail (iid != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (callback != NULL, CORBA_OBJECT_NIL); - - return panel_applet_shlib_factory_closure ( - iid, applet_type, poa, impl_ptr, - g_cclosure_new (G_CALLBACK (callback), - user_data, NULL), - ev); + g_hash_table_insert (applet->priv->notifies, + g_strdup (IN_property), + GINT_TO_POINTER (TRUE)); + + return TRUE; } void Index: libpanel-applet/panel-applet.h =================================================================== RCS file: /cvs/gnome/gnome-panel/libpanel-applet/panel-applet.h,v retrieving revision 1.39 diff -u -u -r1.39 panel-applet.h --- libpanel-applet/panel-applet.h 28 Dec 2005 21:11:21 -0000 1.39 +++ libpanel-applet/panel-applet.h 27 Feb 2006 11:18:23 -0000 @@ -28,24 +28,19 @@ #include #include #include +#include #include #include + +/* Compatibility */ +#include #include #include -#include -#include +#include "panel-applet-menu.h" G_BEGIN_DECLS -typedef GNOME_Vertigo_PanelOrient PanelAppletOrient; - -#define PANEL_APPLET_ORIENT_UP GNOME_Vertigo_PANEL_ORIENT_UP -#define PANEL_APPLET_ORIENT_DOWN GNOME_Vertigo_PANEL_ORIENT_DOWN -#define PANEL_APPLET_ORIENT_LEFT GNOME_Vertigo_PANEL_ORIENT_LEFT -#define PANEL_APPLET_ORIENT_RIGHT GNOME_Vertigo_PANEL_ORIENT_RIGHT - - #define PANEL_TYPE_APPLET (panel_applet_get_type ()) #define PANEL_APPLET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PANEL_TYPE_APPLET, PanelApplet)) #define PANEL_APPLET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PANEL_TYPE_APPLET, PanelAppletClass)) @@ -53,6 +48,22 @@ #define PANEL_IS_APPLET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PANEL_TYPE_APPLET)) #define PANEL_APPLET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PANEL_TYPE_APPLET, PanelAppletClass)) +/* Compatibility */ +#define GNOME_Vertigo_PANEL_XX_SMALL 12 +#define GNOME_Vertigo_PANEL_X_SMALL 24 +#define GNOME_Vertigo_PANEL_SMALL 36 +#define GNOME_Vertigo_PANEL_MEDIUM 48 +#define GNOME_Vertigo_PANEL_LARGE 64 +#define GNOME_Vertigo_PANEL_X_LARGE 80 +#define GNOME_Vertigo_PANEL_XX_LARGE 128 + +typedef enum { + PANEL_APPLET_ORIENT_UP = 1 << 0, + PANEL_APPLET_ORIENT_RIGHT = 1 << 1, + PANEL_APPLET_ORIENT_DOWN = 1 << 2, + PANEL_APPLET_ORIENT_LEFT = 1 << 3 +} PanelAppletOrient; + typedef enum { PANEL_NO_BACKGROUND, PANEL_COLOR_BACKGROUND, @@ -70,10 +81,6 @@ typedef struct _PanelAppletClass PanelAppletClass; typedef struct _PanelAppletPrivate PanelAppletPrivate; -typedef gboolean (*PanelAppletFactoryCallback) (PanelApplet *applet, - const gchar *iid, - gpointer user_data); - struct _PanelApplet { GtkEventBox event_box; @@ -97,82 +104,62 @@ GtkDirectionType direction); }; -GType panel_applet_get_type (void) G_GNUC_CONST; - -GtkWidget *panel_applet_new (void); +GType panel_applet_get_type (void) G_GNUC_CONST; -PanelAppletOrient panel_applet_get_orient (PanelApplet *applet); +GtkWidget *panel_applet_new (void); -guint panel_applet_get_size (PanelApplet *applet); +PanelAppletOrient panel_applet_get_orient (PanelApplet *applet); + +void panel_applet_set_size (PanelApplet *applet, + guint size); +guint panel_applet_get_size (PanelApplet *applet); PanelAppletBackgroundType - panel_applet_get_background (PanelApplet *applet, - /* return values */ - GdkColor *color, - GdkPixmap **pixmap); - -void panel_applet_set_background_widget (PanelApplet *applet, - GtkWidget *widget); - -gchar *panel_applet_get_preferences_key (PanelApplet *applet); - -void panel_applet_add_preferences (PanelApplet *applet, - const gchar *schema_dir, - GError **opt_error); - -PanelAppletFlags panel_applet_get_flags (PanelApplet *applet); -void panel_applet_set_flags (PanelApplet *applet, - PanelAppletFlags flags); - -void panel_applet_set_size_hints (PanelApplet *applet, - const int *size_hints, - int n_elements, - int base_size); - -gboolean panel_applet_get_locked_down (PanelApplet *applet); - -void panel_applet_request_focus (PanelApplet *applet, - guint32 timestamp); - -BonoboControl *panel_applet_get_control (PanelApplet *applet); -BonoboUIComponent *panel_applet_get_popup_component (PanelApplet *applet); - -void panel_applet_setup_menu (PanelApplet *applet, - const gchar *xml, - const BonoboUIVerb *verb_list, - gpointer user_data); - -void panel_applet_setup_menu_from_file (PanelApplet *applet, - const gchar *opt_datadir, - const gchar *file, - const gchar *opt_app_name, - const BonoboUIVerb *verb_list, - gpointer user_data); - - -int panel_applet_factory_main (const gchar *iid, - GType applet_type, - PanelAppletFactoryCallback callback, - gpointer data); - -int panel_applet_factory_main_closure (const gchar *iid, - GType applet_type, - GClosure *closure); - -Bonobo_Unknown panel_applet_shlib_factory (const char *iid, - GType applet_type, - PortableServer_POA poa, - gpointer impl_ptr, - PanelAppletFactoryCallback callback, - gpointer user_data, - CORBA_Environment *ev); - -Bonobo_Unknown panel_applet_shlib_factory_closure (const char *iid, - GType applet_type, - PortableServer_POA poa, - gpointer impl_ptr, - GClosure *closure, - CORBA_Environment *ev); + panel_applet_get_background (PanelApplet *applet, + /* return values */ + GdkColor *color, + GdkPixmap **pixmap); + +void panel_applet_set_background_widget (PanelApplet *applet, + GtkWidget *widget); + +gchar *panel_applet_get_preferences_key (PanelApplet *applet); + +void panel_applet_add_preferences (PanelApplet *applet, + const gchar *schema_dir, + GError **opt_error); + +PanelAppletFlags panel_applet_get_flags (PanelApplet *applet); +void panel_applet_set_flags (PanelApplet *applet, + PanelAppletFlags flags); + +void panel_applet_set_size_hints (PanelApplet *applet, + const int *size_hints, + int n_elements, + int base_size); + +gboolean panel_applet_get_locked_down (PanelApplet *applet); + +void panel_applet_request_focus (PanelApplet *applet, + guint32 timestamp); + +/* Menu */ +PanelAppletMenu *panel_applet_get_menu (PanelApplet *applet); + + +/* Compatibility */ +void panel_applet_setup_menu (PanelApplet *applet, + const gchar *xml, + const BonoboUIVerb *verb_list, + gpointer user_data); +void panel_applet_setup_menu_from_file (PanelApplet *applet, + const gchar *opt_datadir, + const gchar *file, + const gchar *opt_app_name, + const BonoboUIVerb *verb_list, + gpointer user_data); +BonoboUIComponent *panel_applet_get_popup_component (PanelApplet *applet); + /* * These macros are getting a bit unwieldy. @@ -182,10 +169,10 @@ * GETTEXT_PACKAGE and GNOMELOCALEDIR * + optional : PREFIX, SYSCONFDIR, DATADIR and LIBDIR. */ - +#include "panel-applet-factory.h" #if !defined(ENABLE_NLS) #if defined(PREFIX) && defined(SYSCONFDIR) && defined(DATADIR) && defined(LIBDIR) -#define PANEL_APPLET_BONOBO_FACTORY(iid, type, name, version, callback, data) \ +#define PANEL_APPLET_FACTORY_MAIN(iid, type, name, version, callback, data) \ int main (int argc, char *argv []) \ { \ gnome_program_init (name, version, \ @@ -197,7 +184,7 @@ return panel_applet_factory_main (iid, type, callback, data); \ } #else /* !defined(PREFIX) ... */ -#define PANEL_APPLET_BONOBO_FACTORY(iid, type, name, version, callback, data) \ +#define PANEL_APPLET_FACTORY_MAIN(iid, type, name, version, callback, data) \ int main (int argc, char *argv []) \ { \ gnome_program_init (name, version, \ @@ -211,7 +198,7 @@ #else /* defined(ENABLE_NLS) */ #include #if defined(PREFIX) && defined(SYSCONFDIR) && defined(DATADIR) && defined(LIBDIR) -#define PANEL_APPLET_BONOBO_FACTORY(iid, type, name, version, callback, data) \ +#define PANEL_APPLET_FACTORY_MAIN(iid, type, name, version, callback, data) \ int main (int argc, char *argv []) \ { \ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); \ @@ -226,7 +213,7 @@ return panel_applet_factory_main (iid, type, callback, data); \ } #else /* !defined(PREFIX) ... */ -#define PANEL_APPLET_BONOBO_FACTORY(iid, type, name, version, callback, data) \ +#define PANEL_APPLET_FACTORY_MAIN(iid, type, name, version, callback, data) \ int main (int argc, char *argv []) \ { \ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); \ @@ -242,42 +229,8 @@ #endif /* defined(PREFIX) ... */ #endif /* !defined(ENABLE_NLS) */ -#if !defined(ENABLE_NLS) -#define PANEL_APPLET_BONOBO_SHLIB_FACTORY(iid, type, descr, callback, data) \ -static Bonobo_Unknown \ -__panel_applet_shlib_factory (PortableServer_POA poa, \ - const char *oafiid, \ - gpointer impl_ptr, \ - CORBA_Environment *ev) \ -{ \ - return panel_applet_shlib_factory ((iid), (type), poa, impl_ptr, \ - (callback), (data), ev); \ -} \ -static BonoboActivationPluginObject plugin_list[] = { \ - { (iid), __panel_applet_shlib_factory }, \ - { NULL } \ -}; \ -const BonoboActivationPlugin Bonobo_Plugin_info = { plugin_list, (descr) }; -#else /* defined(ENABLE_NLS) */ -#include -#define PANEL_APPLET_BONOBO_SHLIB_FACTORY(iid, type, descr, callback, data) \ -static Bonobo_Unknown \ -__panel_applet_shlib_factory (PortableServer_POA poa, \ - const char *oafiid, \ - gpointer impl_ptr, \ - CORBA_Environment *ev) \ -{ \ - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); \ - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); \ - return panel_applet_shlib_factory ((iid), (type), poa, impl_ptr, \ - (callback), (data), ev); \ -} \ -static BonoboActivationPluginObject plugin_list[] = { \ - { (iid), __panel_applet_shlib_factory }, \ - { NULL } \ -}; \ -const BonoboActivationPlugin Bonobo_Plugin_info = { plugin_list, (descr) }; -#endif /* !defined(ENABLE_NLS) */ +/* Only for compatibility */ +#define PANEL_APPLET_BONOBO_FACTORY PANEL_APPLET_FACTORY_MAIN G_END_DECLS Index: libpanel-applet/panel-test-applets.c =================================================================== RCS file: /cvs/gnome/gnome-panel/libpanel-applet/panel-test-applets.c,v retrieving revision 1.10 diff -u -u -r1.10 panel-test-applets.c --- libpanel-applet/panel-test-applets.c 12 Feb 2006 18:40:41 -0000 1.10 +++ libpanel-applet/panel-test-applets.c 27 Feb 2006 11:18:23 -0000 @@ -3,327 +3,440 @@ * * Authors: * Mark McLoughlin + * Carlos Garcia Campos * * Copyright 2002 Sun Microsystems, Inc. */ #include +#include #include #include #include -#include -#include +#include +#include +#include #include -#include "panel-applet.h" +/* Compatibility */ +#include + +#include "panel-applet-manager.h" +#include "panel-applet-container.h" + -void on_execute_button_clicked (GtkButton *button, gpointer dummy); +static void menu_remove_cb (GtkAction *action, gpointer gdata); -static GtkWidget *win = NULL; -static GtkWidget *applet_combo = NULL; +static GtkWidget *applet_list = NULL; static GtkWidget *prefs_dir_entry = NULL; static GtkWidget *orient_combo = NULL; -static GtkWidget *size_combo = NULL; +static GtkWidget *size_spin = NULL; -static char *cli_iid = NULL; +static char *cli_id = NULL; static char *cli_prefs_dir = NULL; -static char *cli_size = NULL; +static guint cli_size = 24; static char *cli_orient = NULL; -static const GOptionEntry options [] = { - { "iid", 0, 0, G_OPTION_ARG_STRING, &cli_iid, N_("Specify an applet IID to load"), NULL}, - { "prefs-dir", 0, 0, G_OPTION_ARG_STRING, &cli_prefs_dir, N_("Specify a gconf location in which the applet preferences should be stored"), NULL}, - { "size", 0, 0, G_OPTION_ARG_STRING, &cli_size, N_("Specify the initial size of the applet (xx-small, medium, large etc.)"), NULL}, - { "orient", 0, 0, G_OPTION_ARG_STRING, &cli_orient, N_("Specify the initial orientation of the applet (top, bottom, left or right)"), NULL}, - { NULL} +static const GOptionEntry options[] = +{ + { "id", 'i', 0, G_OPTION_ARG_STRING, &cli_id, N_("Specify an applet ID to load"), NULL }, + { "prefs-dir", 'p', 0, G_OPTION_ARG_STRING, &cli_prefs_dir, N_("Specify a gconf location in which the applet preferences should be stored"), NULL }, + { "size", 's', 0, G_OPTION_ARG_INT, &cli_size, N_("Specify the initial size in pixels of the applet"), NULL }, + { "orient", 'o', 0, G_OPTION_ARG_STRING, &cli_orient, N_("Specify the initial orientation of the applet (top, bottom, left or right)"), NULL }, + { NULL } }; enum { + COLUMN_ICON, COLUMN_TEXT, COLUMN_ITEM, NUMBER_COLUMNS }; -typedef struct { - const char *name; - const char *value; -} ComboItem; - -static ComboItem orient_items [] = { - { N_("Orientation|Top"), "top" }, - { N_("Orientation|Bottom"), "bottom" }, - { N_("Orientation|Left"), "left" }, - { N_("Orientation|Right"), "right" } +typedef enum { + ORIENTATION_TOP = 1 << 0, + ORIENTATION_RIGHT = 1 << 1, + ORIENTATION_BOTTOM = 1 << 2, + ORIENTATION_LEFT = 1 << 3 +} PanelOrientation; + +static const GtkActionEntry test_menu_actions[] = { + { "TestRemove", GTK_STOCK_REMOVE, N_("_Remove"), + NULL, NULL, + G_CALLBACK (menu_remove_cb) }, }; +static const gchar *test_menu_ui = +"\n" +" \n" +""; -static ComboItem size_items [] = { - { N_("Size|XX Small"), "xx-small" }, - { N_("Size|X Small"), "x-small" }, - { N_("Size|Small"), "small" }, - { N_("Size|Medium"), "medium" }, - { N_("Size|Large"), "large" }, - { N_("Size|X Large"), "x-large" }, - { N_("Size|XX Large"), "xx-large" } -}; - -static char * -get_combo_value (GtkWidget *combo_box) +static void +menu_remove_cb (GtkAction *action, gpointer gdata) { - GtkTreeIter iter; - GtkTreeModel *model; - char *value; + GtkWidget *window = GTK_WIDGET (gdata); - if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter)) - return NULL; + gtk_widget_destroy (window); +} - model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)); - gtk_tree_model_get (model, &iter, COLUMN_ITEM, &value, -1); +static PanelOrientation +get_orient_from_string (const gchar *str) +{ + if (g_ascii_strcasecmp (str, "Top") == 0) { + return ORIENTATION_TOP; + } else if (g_ascii_strcasecmp (str, "Bottom") == 0) { + return ORIENTATION_BOTTOM; + } else if (g_ascii_strcasecmp (str, "Left") == 0) { + return ORIENTATION_LEFT; + } else if (g_ascii_strcasecmp (str, "Right") == 0) { + return ORIENTATION_RIGHT; + } - return value; + return ORIENTATION_TOP; } -static char * -construct_moniker (void) +static PanelOrientation +get_orient_combo_value (void) { - const char *prefs_key; - char *iid; - char *size; - char *orient; - char *ret_value; - - iid = get_combo_value (applet_combo); - g_assert (iid != NULL); - size = get_combo_value (size_combo); - g_assert (size != NULL); - orient = get_combo_value (orient_combo); - g_assert (orient != NULL); + PanelOrientation orient; + gchar *item = NULL; + + item = gtk_combo_box_get_active_text (GTK_COMBO_BOX (orient_combo)); - prefs_key = gtk_entry_get_text (GTK_ENTRY (prefs_dir_entry)); + if (!item) + return ORIENTATION_TOP; - ret_value= g_strdup_printf ("%s!prefs_key=%s;size=%s;orient=%s", - iid, prefs_key, size, orient); - g_free (iid); - g_free (size); - g_free (orient); + orient = get_orient_from_string (item); + g_free (item); - return ret_value; + return orient; } -static void -load_applet_into_window (const char *moniker, - const char *title) +static gboolean +applet_activated (PanelAppletContainer *container, + GError *error, + gpointer user_data) { - GtkWidget *applet_window; - GtkWidget *applet; - - applet = bonobo_widget_new_control (moniker, NULL); - - if (!applet) { + GtkWidget *applet_window = GTK_WIDGET (user_data); + + if (error) { GtkWidget *dialog; - dialog = gtk_message_dialog_new (win ? GTK_WINDOW (win) : NULL, + dialog = gtk_message_dialog_new (applet_window ? GTK_WINDOW (applet_window) : NULL, GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - _("Failed to load applet %s"), - title); + _("Failed to load applet\n%s"), + error->message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - return; + + g_clear_error (&error); + gtk_widget_destroy (applet_window); + + return FALSE; } - applet_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + panel_applet_container_menu_add_actions (PANEL_APPLET_CONTAINER (container), + test_menu_actions, + G_N_ELEMENTS (test_menu_actions), + user_data); + panel_applet_container_menu_add_ui_from_string (PANEL_APPLET_CONTAINER (container), + test_menu_ui); + + return TRUE; +} + +static void +destroy_window (GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + gtk_widget_destroy (widget); +} - gtk_widget_show (applet); +static void +load_applet_into_window (GtkWidget *applet_window, + const gchar *applet_id, + const gchar *prefs_key, + PanelOrientation orient, + guint size) +{ + GtkWidget *container; - gtk_container_add (GTK_CONTAINER (applet_window), applet); + container = panel_applet_container_new (); + gtk_container_add (GTK_CONTAINER (applet_window), container); + gtk_widget_show (container); + + panel_applet_container_add_with_properties (PANEL_APPLET_CONTAINER (container), + applet_id, + (PanelAppletActivateCb)applet_activated, + applet_window, + "orient", orient, + "prefs-key", prefs_key, + "size", size, NULL); //FIXME: we could set the window icon with the applet icon - gtk_window_set_title (GTK_WINDOW (applet_window), title); + gtk_window_set_title (GTK_WINDOW (applet_window), applet_id); gtk_widget_show (applet_window); } static void -load_applet_from_command_line (void) +load_applet_from_gui (void) { - GString *str; - - g_assert (cli_iid != NULL); - - str = g_string_new (cli_iid); + PanelOrientation orient; + guint size; + const gchar *prefs_key; + GtkWidget *applet_window; + GtkTreeSelection *selection; + GtkTreeModel *model; + GtkTreeIter iter; + gchar *applet_id = NULL; + + orient = get_orient_combo_value (); + size = gtk_spin_button_get_value_as_int ( + GTK_SPIN_BUTTON (size_spin)); + prefs_key = gtk_entry_get_text (GTK_ENTRY (prefs_dir_entry)); - if (cli_prefs_dir || cli_size || cli_orient) { - g_string_append_c (str, '!'); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (applet_list)); + gtk_tree_selection_get_selected (selection, &model, &iter); - if (cli_prefs_dir) - g_string_append_printf (str, "prefs_key=%s", cli_prefs_dir); + gtk_tree_model_get (model, &iter, + COLUMN_ITEM, &applet_id, + -1); - g_string_append_c (str, ';'); + applet_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + g_signal_connect (G_OBJECT (applet_window), "delete-event", + G_CALLBACK (destroy_window), NULL); + + load_applet_into_window (applet_window, applet_id, + prefs_key, orient, size); - if (cli_size) - g_string_append_printf (str, "size=%s", cli_size); + g_free (applet_id); +} - g_string_append_c (str, ';'); +static void +load_applet_from_command_line (void) +{ + PanelOrientation orient; + GtkWidget *applet_window; - if (cli_orient) - g_string_append_printf (str, "orient=%s", cli_orient); - } - - g_print ("Loading %s\n", str->str); + g_assert (cli_id != NULL); - load_applet_into_window (str->str, cli_iid); + orient = (!cli_orient) ? ORIENTATION_TOP : get_orient_from_string (cli_orient); - g_string_free (str, TRUE); + applet_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + g_signal_connect (G_OBJECT (applet_window), "delete-event", + G_CALLBACK (gtk_main_quit), NULL); + g_signal_connect (G_OBJECT (applet_window), "destroy", + G_CALLBACK (gtk_main_quit), NULL); + + load_applet_into_window (applet_window, cli_id, + cli_prefs_dir, + orient, cli_size); } -G_GNUC_UNUSED void -on_execute_button_clicked (GtkButton *button, - gpointer dummy) +static void +selection_changed (GtkTreeSelection *selection, + GtkWidget *button) { - char *moniker; - char *title; - - moniker = construct_moniker (); - title = get_combo_value (applet_combo); - load_applet_into_window (moniker, title); - g_free (moniker); - g_free (title); + gtk_widget_set_sensitive (button, + gtk_tree_selection_get_selected (selection, + NULL, NULL)); } -static void -setup_combo (GtkWidget *combo_box, - ComboItem *items, - int nb_items, - gboolean dynamic) -{ - GtkListStore *model; - GtkTreeIter iter; - GtkCellRenderer *renderer; - int i; - - model = gtk_list_store_new (NUMBER_COLUMNS, - G_TYPE_STRING, - G_TYPE_STRING); - - gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), - GTK_TREE_MODEL (model)); - - - for (i = 0; i < nb_items; i++) { - gtk_list_store_append (model, &iter); - gtk_list_store_set (model, &iter, - COLUMN_TEXT, dynamic ? g_strdup (items [i].name) : Q_(items [i].name), - COLUMN_ITEM, dynamic ? g_strdup (items [i].value) : items [i].value, +static GtkTreeModel * +create_model (void) +{ + GtkTreeModel *model; + PanelAppletManager *manager; + GList *applets = NULL, *l = NULL; + gint i; + + model = GTK_TREE_MODEL (gtk_list_store_new (NUMBER_COLUMNS, + GDK_TYPE_PIXBUF, + G_TYPE_STRING, + G_TYPE_STRING)); + + manager = panel_applet_manager_new (); + applets = panel_applet_manager_get_applets (manager); + + for (l = applets, i = 0; l; l = g_list_next (l), i++) { + PanelAppletInfo *info; + GtkTreeIter iter; + GdkPixbuf *pixbuf = NULL; + gchar *p, *icon_name = NULL; + gchar *text; + + info = (PanelAppletInfo *) l->data; + + if (info->icon) { + p = g_strrstr (info->icon, "."); + if (p && + (g_ascii_strcasecmp (p, ".png") == 0 || + g_ascii_strcasecmp (p, ".xpm") == 0 || + g_ascii_strcasecmp (p, ".svg") == 0)) { + icon_name = g_strndup (info->icon, + strlen (info->icon) - strlen (p)); + } + + if (icon_name) { + pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), + icon_name, 24, 0, NULL); + g_free (icon_name); + } + } + + text = g_markup_printf_escaped ("%s\n%s", + info->name, info->comment); + + gtk_list_store_append (GTK_LIST_STORE (model), &iter); + gtk_list_store_set (GTK_LIST_STORE (model), &iter, + COLUMN_ICON, pixbuf, + COLUMN_TEXT, text, + COLUMN_ITEM, info->id, -1); + + if (pixbuf) + g_object_unref (pixbuf); + g_free (text); + + panel_applet_info_free (info); } - renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), - renderer, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), - renderer, "text", COLUMN_TEXT, NULL); + g_list_free (applets); + g_object_unref (manager); - gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0); + return model; } static void -setup_options (void) +setup_list (void) { - Bonobo_ServerInfoList *applets; - CORBA_Environment env; - int i; - char *prefs_dir; - char *unique_key; - ComboItem *applet_items; - int applet_nb; - - CORBA_exception_init (&env); - - applets = bonobo_activation_query ( - "has (repo_ids, 'IDL:GNOME/Vertigo/PanelAppletShell:1.0')", - NULL, &env); - - if (BONOBO_EX (&env)) - g_error (_("query returned exception %s\n"), BONOBO_EX_REPOID (&env)); - - CORBA_exception_free (&env); - - applet_nb = applets->_length; - applet_items = g_new0 (ComboItem, applet_nb); + GtkCellRenderer *renderer; + + gtk_tree_view_set_model (GTK_TREE_VIEW (applet_list), + create_model ()); - for (i = 0; i < applet_nb; i++) { - Bonobo_ServerInfo *info; + renderer = gtk_cell_renderer_pixbuf_new (); + g_object_set (G_OBJECT (renderer), + "xpad", 4, "ypad", 4, + NULL); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (applet_list), + -1, NULL, + renderer, + "pixbuf", COLUMN_ICON, + NULL); - info = &applets->_buffer [i]; + renderer = gtk_cell_renderer_text_new (); + g_object_set (G_OBJECT (renderer), + "ellipsize", PANGO_ELLIPSIZE_END, + NULL); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (applet_list), + -1, NULL, + renderer, + "markup", COLUMN_TEXT, + NULL); +} - applet_items[i].name = info->iid; - applet_items[i].value = info->iid; - } +static void +setup_options (void) +{ + char *prefs_dir; + char *unique_key; - setup_combo (applet_combo, applet_items, applet_nb, TRUE); - g_free (applet_items); - CORBA_free (applets); - - setup_combo (size_combo, size_items, G_N_ELEMENTS (size_items), FALSE); - setup_combo (orient_combo, orient_items, - G_N_ELEMENTS (orient_items), FALSE); + setup_list (); unique_key = gconf_unique_key (); prefs_dir = g_strdup_printf ("/tmp/%s", unique_key); g_free (unique_key); gtk_entry_set_text (GTK_ENTRY (prefs_dir_entry), prefs_dir); g_free (prefs_dir); + + gtk_combo_box_set_active (GTK_COMBO_BOX (orient_combo), 0); +} + +static void +quit (GtkWidget *w, GdkEvent *event, gpointer user_data) +{ + gtk_dialog_response (GTK_DIALOG (w), + GTK_RESPONSE_CLOSE); +} + +static void +dialog_response (GtkDialog *dialog, gint arg1, gpointer user_data) +{ + switch (arg1) { + case GTK_RESPONSE_OK: + load_applet_from_gui (); + break; + default: + gtk_widget_destroy (GTK_WIDGET (dialog)); + gtk_main_quit (); + } } int main (int argc, char **argv) { - GOptionContext *context; - GladeXML *gui; - char *gladefile; - - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - - context = g_option_context_new (""); + GtkWidget *dialog; + GtkWidget *create_button; + GtkTreeSelection *selection; + GladeXML *gui; + char *gladefile; + GOptionContext *context; + context = g_option_context_new ("Test Applets Utility"); g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); - - gnome_program_init (argv [0], "0.0.0.0", LIBGNOMEUI_MODULE, + g_option_context_add_group (context, gtk_get_option_group (TRUE)); + + gnome_program_init (argv[0], "0.0.0.0", + LIBGNOMEUI_MODULE, argc, argv, - GNOME_PARAM_GOPTION_CONTEXT, context, + GNOME_PARAM_GOPTION_CONTEXT, context, GNOME_PARAM_NONE); g_option_context_free (context); - if (cli_iid) { + if (cli_id) { load_applet_from_command_line (); gtk_main (); + return 0; } - gladefile = PANEL_APPLET_GLADEDIR "/panel-test-applets.glade"; + gladefile = g_build_filename (PANEL_APPLET_GLADEDIR, "/panel-test-applets.glade", NULL); gui = glade_xml_new (gladefile, "toplevel", NULL); if (!gui) { g_warning ("Error loading `%s'", gladefile); + g_free (gladefile); + return 1; } + g_free (gladefile); - glade_xml_signal_autoconnect (gui); - - win = glade_xml_get_widget (gui, "toplevel"); - applet_combo = glade_xml_get_widget (gui, "applet-combo"); - prefs_dir_entry = glade_xml_get_widget (gui, "prefs-dir-entry"); - orient_combo = glade_xml_get_widget (gui, "orient-combo"); - size_combo = glade_xml_get_widget (gui, "size-combo"); + dialog = glade_xml_get_widget (gui, "toplevel"); + applet_list = glade_xml_get_widget (gui, "applet_list"); + prefs_dir_entry = glade_xml_get_widget (gui, "prefs_entry"); + orient_combo = glade_xml_get_widget (gui, "orient_combo"); + size_spin = glade_xml_get_widget (gui, "size_spin"); + + g_signal_connect (G_OBJECT (dialog), "delete-event", + G_CALLBACK (quit), NULL); + g_signal_connect (G_OBJECT (dialog), "response", + G_CALLBACK (dialog_response), NULL); setup_options (); - gtk_widget_show (win); + create_button = glade_xml_get_widget (gui, "create_button"); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (applet_list)); + g_signal_connect (G_OBJECT (selection), "changed", + G_CALLBACK (selection_changed), + (gpointer) create_button); + + gtk_widget_show (dialog); gtk_main (); + + g_object_unref (gui); return 0; } Index: libpanel-applet/panel-test-applets.glade =================================================================== RCS file: /cvs/gnome/gnome-panel/libpanel-applet/panel-test-applets.glade,v retrieving revision 1.5 diff -u -u -r1.5 panel-test-applets.glade --- libpanel-applet/panel-test-applets.glade 30 Dec 2005 10:36:45 -0000 1.5 +++ libpanel-applet/panel-test-applets.glade 27 Feb 2006 11:18:23 -0000 @@ -4,10 +4,11 @@ + 6 True - Test applet utility + Test applets utility GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE + GTK_WIN_POS_CENTER False True False @@ -17,46 +18,104 @@ GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST True - False False - - + True False - 8 + 6 - + True GTK_BUTTONBOX_END - + True True True - gtk-execute + gtk-close True GTK_RELIEF_NORMAL True - 0 - + -7 - + True True True - gtk-close - True GTK_RELIEF_NORMAL True - -7 - + -5 + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-new + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Create + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + @@ -69,210 +128,296 @@ - - 2 + True - 5 - 2 False - 4 - 4 - - - - True - _Size: - True - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - size-combo - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 4 - 5 - - - - - - - - True - _Applet: - True - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - applet-combo - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - - - - + 0 - + True - _Orientation: - True - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - orient-combo - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 3 - 4 - - - - - - - - True - _Prefs Dir: - True - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - prefs-dir-entry - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 2 - 3 - - - - - - - True - False - True - - - 1 - 2 - 0 - 1 - fill - fill - - - - - - True - False - True - - - 1 - 2 - 3 - 4 - fill - fill - - - - - - True - False - True + 0 + 0.5 + GTK_SHADOW_NONE + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + 6 + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + False + True + False + False + False + + + + + + + + + + True + <b>Applets</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + - 1 - 2 - 4 - 5 - fill - fill + 0 + True + True - + True + 0 + 0.5 + GTK_SHADOW_NONE + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + 6 + True + 3 + 2 + False + 6 + 6 + + + + True + _Preferences: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + prefs_entry + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + _Orientation: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + _Size + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + size_spin + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + Top +Bottom +Left +Right + False + True + + + 1 + 2 + 1 + 2 + fill + fill + + + + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 16 16 256 1 10 10 + + + 1 + 2 + 2 + 3 + + + + + + + + + + + True + <b>Properties</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + - 0 - 2 - 1 - 2 - fill + 0 + False + True Index: libpanel-applet/test-bonobo-applet.c =================================================================== RCS file: /cvs/gnome/gnome-panel/libpanel-applet/test-bonobo-applet.c,v retrieving revision 1.22 diff -u -u -r1.22 test-bonobo-applet.c --- libpanel-applet/test-bonobo-applet.c 17 Apr 2002 14:12:50 -0000 1.22 +++ libpanel-applet/test-bonobo-applet.c 27 Feb 2006 11:18:23 -0000 @@ -20,10 +20,7 @@ static void test_applet_on_do (BonoboUIComponent *uic, gpointer user_data, - const gchar *verbname) -{ - g_message ("%s called\n", verbname); -} + const gchar *verbname); static const BonoboUIVerb test_applet_menu_verbs [] = { BONOBO_UI_VERB ("TestAppletDo1", test_applet_on_do), @@ -37,6 +34,7 @@ "\n" " \n" " \n" + "" " \n" "\n"; @@ -45,6 +43,19 @@ GtkWidget *label; } TestApplet; +static void +test_applet_on_do (BonoboUIComponent *uic, + gpointer user_data, + const gchar *verbname) +{ + TestApplet *applet = (TestApplet *) user_data; + + gtk_label_set (GTK_LABEL (applet->label), "clicked!"); + gtk_widget_show (GTK_WIDGET (applet)); + g_message ("called\n"); + // g_message ("%s called\n", verbname); +} + static GType test_applet_get_type (void) { @@ -97,7 +108,7 @@ gint size, gpointer dummy) { - switch (size) { +/* switch (size) { case GNOME_Vertigo_PANEL_XX_SMALL: gtk_label_set_markup ( GTK_LABEL (applet->label), "Hello"); @@ -129,7 +140,7 @@ default: g_assert_not_reached (); break; - } + }*/ } static void @@ -162,21 +173,30 @@ static gboolean test_applet_fill (TestApplet *applet) { - applet->label = gtk_label_new (NULL); + BonoboUIComponent *popup_component; + + applet->label = gtk_label_new ("Test Applet"); gtk_container_add (GTK_CONTAINER (applet), applet->label); gtk_widget_show_all (GTK_WIDGET (applet)); - test_applet_handle_size_change (applet, GNOME_Vertigo_PANEL_MEDIUM, NULL); +// test_applet_handle_size_change (applet, GNOME_Vertigo_PANEL_MEDIUM, NULL); panel_applet_setup_menu ( - PANEL_APPLET (applet), test_applet_menu_xml, test_applet_menu_verbs, NULL); + PANEL_APPLET (applet), test_applet_menu_xml, test_applet_menu_verbs, applet); test_applet_setup_tooltips (GTK_WIDGET (applet)); panel_applet_set_flags (PANEL_APPLET (applet), PANEL_APPLET_HAS_HANDLE); + popup_component = panel_applet_get_popup_component (PANEL_APPLET (applet)); + + bonobo_ui_component_set_prop (popup_component, + "/commands/TestAppletDo1", + "hidden", "1", + NULL); + g_signal_connect (G_OBJECT (applet), "change_orient", G_CALLBACK (test_applet_handle_orient_change), @@ -203,8 +223,8 @@ gboolean retval = FALSE; if (!strcmp (iid, "OAFIID:GNOME_Panel_TestBonoboApplet")) - retval = test_applet_fill (applet); - + retval = test_applet_fill (applet); + return retval; } Index: po/POTFILES.in =================================================================== RCS file: /cvs/gnome/gnome-panel/po/POTFILES.in,v retrieving revision 1.165 diff -u -u -r1.165 POTFILES.in --- po/POTFILES.in 16 Jan 2006 17:42:56 -0000 1.165 +++ po/POTFILES.in 27 Feb 2006 11:18:23 -0000 @@ -2,24 +2,24 @@ # Please keep this file sorted alphabetically. [encoding: UTF-8] applets/clock/GNOME_ClockApplet.xml -applets/clock/GNOME_ClockApplet_Factory.server.in.in applets/clock/calendar-client.c applets/clock/clock.c applets/clock/clock.schemas.in +applets/clock/org.gnome.panel.applet.Clock.service.in.in applets/fish/GNOME_FishApplet.xml -applets/fish/GNOME_FishApplet_Factory.server.in.in applets/fish/fish.c applets/fish/fish.glade applets/fish/fish.schemas.in -applets/notification_area/GNOME_NotificationAreaApplet.server.in.in +applets/fish/org.gnome.panel.applet.Fish.service.in.in applets/notification_area/GNOME_NotificationAreaApplet.xml applets/notification_area/eggtraymanager.c applets/notification_area/main.c +applets/notification_area/org.gnome.panel.applet.NotificationArea.service.in.in applets/wncklet/GNOME_ShowDesktopApplet.xml applets/wncklet/GNOME_WindowListApplet.xml applets/wncklet/GNOME_WindowMenuApplet.xml -applets/wncklet/GNOME_Wncklet_Factory.server.in.in applets/wncklet/GNOME_WorkspaceSwitcherApplet.xml +applets/wncklet/org.gnome.panel.applet.Wncklet.service.in.in applets/wncklet/showdesktop.c applets/wncklet/window-list.c applets/wncklet/window-list.glade @@ -29,7 +29,7 @@ applets/wncklet/workspace-switcher.c applets/wncklet/workspace-switcher.glade applets/wncklet/workspace-switcher.schemas.in -gnome-panel/GNOME_Panel.server.in +gnome-applets-manager/applets-manager.c gnome-panel/GNOME_Panel_Popup.xml gnome-panel/applet.c gnome-panel/button-widget.c @@ -69,7 +69,7 @@ gnome-panel/panel-toplevel.schemas.in gnome-panel/panel-util.c gnome-panel/panel.c -libpanel-applet/GNOME_Panel_TestApplet.server.in libpanel-applet/panel-applet.c libpanel-applet/panel-test-applets.c libpanel-applet/panel-test-applets.glade +libpanel-applet/test-applet.c