[gnome-pilot] 2009-10-22 remove most libgnomeui/libgnome dependencies. Still used for gnome initialisation.
- From: Matthew Charles Davey <mcdavey src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-pilot] 2009-10-22 remove most libgnomeui/libgnome dependencies. Still used for gnome initialisation.
- Date: Thu, 22 Oct 2009 01:41:52 +0000 (UTC)
commit ad94e642cdcf34bd359f29b8d6a761f6aef37697
Author: Matt Davey <mcdavey mrao cam ac uk>
Date: Thu Oct 22 02:37:42 2009 +0100
2009-10-22 remove most libgnomeui/libgnome dependencies. Still used for gnome initialisation.
2009-10-22 Matt Davey <mcdavey mrao cam ac uk>
* work on migration away from libgnomeui, libgnome and libglade.
* capplet/gnome-pilot-assistant.c: convert GnomeDruid to
GtkAssistant, migrate from libglade to gtkbuilder,
and remove most use of libgnomeui
* capplet/gnome-pilot-capplet.c: avoid libgnomeui
* capplet/gnome-pilot-capplet.h: ditto
* capplet/gnome-pilot-cdialog.c: ditto
* capplet/gnome-pilot-ddialog.c: ditto
* capplet/gnome-pilot-pdialog.c: ditto
* capplet/gpilotd-capplet.ui: ditto
* capplet/gpilotd-control-applet.c: ditto
* capplet/util.c: ditto
* capplet/util.h: ditto
* conduits/backup/backup_conduit.c: fix incorrect use of
g_strfreev (double free), and fix exclude_files key.
* conduits/file/gpilot_install_file.c: avoid popt.
* configure.in: remove gconf dependency.
* gpilotd/gnome-pilot-config.c: fix typo "migarate_conf"
* gpilotd/gpilotd.c: use gnome_program_init instead of gnome_init
* gpilotd/orbit_daemon_glue.c: fix incorrect use of g_strfreev()
* po/POTFILES.in: add assistant and remove druid.
* utils/gpilotd-client.c: remove popt
* utils/gpilotdcm-client.c: remove popt
ChangeLog | 26 ++++
capplet/gnome-pilot-assistant.c | 3 +-
capplet/gnome-pilot-capplet.c | 268 +++++++++++++++++++++--------------
capplet/gnome-pilot-capplet.h | 1 +
capplet/gnome-pilot-cdialog.c | 56 ++++----
capplet/gnome-pilot-ddialog.c | 55 +++++---
capplet/gnome-pilot-pdialog.c | 35 ++++-
capplet/gpilotd-capplet.ui | 85 ++++++++----
capplet/gpilotd-control-applet.c | 32 ++---
capplet/util.c | 212 ++++++++++++++++++++--------
capplet/util.h | 10 +-
conduits/backup/backup_conduit.c | 12 +-
conduits/file/gpilot_install_file.c | 50 ++++---
configure.in | 5 +-
gpilotd/gnome-pilot-config.c | 4 +-
gpilotd/gpilotd.c | 9 +-
gpilotd/orbit_daemon_glue.c | 3 +-
po/POTFILES.in | 4 +-
utils/gpilotd-client.c | 54 ++++---
utils/gpilotdcm-client.c | 39 ++++--
20 files changed, 632 insertions(+), 331 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9d43a60..0d83075 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2009-10-22 Matt Davey <mcdavey mrao cam ac uk>
+ * work on migration away from libgnomeui, libgnome and libglade.
+ * capplet/gnome-pilot-assistant.c: convert GnomeDruid to
+ GtkAssistant, migrate from libglade to gtkbuilder,
+ and remove most use of libgnomeui
+ * capplet/gnome-pilot-capplet.c: avoid libgnomeui
+ * capplet/gnome-pilot-capplet.h: ditto
+ * capplet/gnome-pilot-cdialog.c: ditto
+ * capplet/gnome-pilot-ddialog.c: ditto
+ * capplet/gnome-pilot-pdialog.c: ditto
+ * capplet/gpilotd-capplet.ui: ditto
+ * capplet/gpilotd-control-applet.c: ditto
+ * capplet/util.c: ditto
+ * capplet/util.h: ditto
+ * conduits/backup/backup_conduit.c: fix incorrect use of
+ g_strfreev (double free), and fix exclude_files key.
+ * conduits/file/gpilot_install_file.c: avoid popt.
+ * configure.in: remove gconf dependency.
+ * gpilotd/gnome-pilot-config.c: fix typo "migarate_conf"
+ * gpilotd/gpilotd.c: use gnome_program_init instead of gnome_init
+ * gpilotd/orbit_daemon_glue.c: fix incorrect use of g_strfreev()
+ * po/POTFILES.in: add assistant and remove druid.
+ * utils/gpilotd-client.c: remove popt
+ * utils/gpilotdcm-client.c: remove popt
+
+
2009-10-18 Matt Davey <mcdavey mrao cam ac uk>
* po/POTFILES.in: remove obsolete gpilotd-conduit-mgmt.h #597328
This was missed in change on 2009-08-28
diff --git a/capplet/gnome-pilot-assistant.c b/capplet/gnome-pilot-assistant.c
index 54c3fb8..661ed89 100644
--- a/capplet/gnome-pilot-assistant.c
+++ b/capplet/gnome-pilot-assistant.c
@@ -31,7 +31,6 @@
#include <config.h>
#endif
-#include <libgnomeui/gnome-uidefs.h>
#include "pilot.h"
#include "util.h"
#include "gnome-pilot-assistant.h"
@@ -328,7 +327,7 @@ get_widgets (GnomePilotAssistant *gpd)
priv->sync_label_vbox = GW ("page_sync");
priv->sync_label = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (priv->sync_label_vbox), priv->sync_label, TRUE, FALSE, GNOME_PAD_SMALL);
+ gtk_box_pack_start (GTK_BOX (priv->sync_label_vbox), priv->sync_label, TRUE, FALSE, 4);
priv->pilot_name = GW ("assistant_pilot_name_entry");
priv->pilot_basedir = GW ("assistant_pilot_basedir_entry");
diff --git a/capplet/gnome-pilot-capplet.c b/capplet/gnome-pilot-capplet.c
index e40166b..f7766e1 100644
--- a/capplet/gnome-pilot-capplet.c
+++ b/capplet/gnome-pilot-capplet.c
@@ -28,7 +28,6 @@
*/
#include <sys/stat.h>
-#include <libgnomeui/gnome-app-helper.h>
#include "pilot.h"
#include "util.h"
#include "gnome-pilot-pdialog.h"
@@ -71,7 +70,7 @@ struct _GnomePilotCappletPrivate
GtkWidget *devices_popup;
GtkObject *pdialog;
- GtkWidget *pilots_menu;
+ GtkWidget *pilots_combo;
GtkWidget *pilots_username;
GtkWidget *conduit_treeview;
GtkTreeModel *conduit_model;
@@ -108,6 +107,10 @@ static void gpcap_devices_delete (GtkWidget *widget, gpointer user_data);
static gboolean gpcap_devices_popup (GtkTreeView *treeview, GdkEventButton *event, gpointer user_data);
static void gpcap_devices_selection_changed (GtkTreeSelection *selection, gpointer user_data);
+static void gpcap_create_pilots_treeview (GnomePilotCappletPrivate *priv);
+static void gpcap_create_devices_treeview (GnomePilotCappletPrivate *priv);
+static void gpcap_create_conduit_treeview (GnomePilotCappletPrivate *priv);
+
static void gpcap_conduits_choose_pilot (GtkWidget *widget, gpointer user_data);
static void gpcap_conduits_enable (GtkWidget *widget, gpointer user_data);
static void gpcap_conduits_disable (GtkWidget *widget, gpointer user_data);
@@ -160,7 +163,11 @@ init (GnomePilotCapplet *gpcap)
{
GnomePilotCappletPrivate *priv;
guint error;
- gchar *objects[] = {"CappletMain", NULL};
+ gchar *objects[] = {"timeout_adjustment",
+ "device_speed_store",
+ "pilot_charset_store",
+ "CappletMain",
+ NULL};
priv = g_new0 (GnomePilotCappletPrivate, 1);
@@ -174,12 +181,15 @@ init (GnomePilotCapplet *gpcap)
priv->ui = gtk_builder_new ();
error = gtk_builder_add_objects_from_file (priv->ui, "gpilotd-capplet.ui", objects, NULL);
if (error == 0) {
- error = gtk_builder_add_objects_from_file (priv->ui, UIDATADIR "/pilotd-capplet.ui", objects, NULL);
+ error = gtk_builder_add_objects_from_file (priv->ui, UIDATADIR "/gpilotd-capplet.ui", objects, NULL);
if (error == 0) {
g_message ("gnome-pilot-capplet init(): Could not load the GtkBuilder UI file!");
goto error;
}
}
+ gpcap_create_pilots_treeview (priv);
+ gpcap_create_devices_treeview (priv);
+ gpcap_create_conduit_treeview (priv);
if (!get_widgets (gpcap)) {
g_message ("gnome-pilot-capplet init(): Could not find all widgets in the UI file!");
@@ -241,7 +251,7 @@ get_widgets (GnomePilotCapplet *gpcap)
priv->devices_edit = GW ("devices_edit_button");
priv->devices_delete = GW ("devices_delete_button");
- priv->pilots_menu = GW ("pilots_menu");
+ priv->pilots_combo = GW ("pilots_combo");
priv->pilots_username = GW ("username_label");
w = GW ("conduit_treeview");
priv->conduit_treeview = gtk_object_get_data (GTK_OBJECT (w), "treeview");
@@ -261,7 +271,7 @@ get_widgets (GnomePilotCapplet *gpcap)
&& priv->devices_add
&& priv->devices_edit
&& priv->devices_delete
- && priv->pilots_menu
+ && priv->pilots_combo
&& priv->conduit_treeview
&& priv->conduit_enable
&& priv->conduit_disable
@@ -363,17 +373,15 @@ fill_pilots_treeview (GnomePilotCapplet *gpcap)
}
}
-GtkWidget* gnome_pilot_capplet_create_pilots_treeview (char *name, char *string1, char *string2, int num1, int num2);
-
-GtkWidget*
-gnome_pilot_capplet_create_pilots_treeview (char *name, char *string1, char *string2, int num1, int num2)
+static void
+gpcap_create_pilots_treeview (GnomePilotCappletPrivate *priv)
{
- GtkWidget *treeview, *scrolled;
+ GtkWidget *treeview;
+ GtkWidget *scrolled = GTK_WIDGET (gtk_builder_get_object (priv->ui, "pilots_treeview"));
GtkTreeSelection *selection;
GtkCellRenderer *renderer;
GtkListStore *model;
- scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
@@ -401,8 +409,6 @@ gnome_pilot_capplet_create_pilots_treeview (char *name, char *string1, char *str
gtk_widget_show (scrolled);
gtk_widget_show (treeview);
-
- return scrolled;
}
static void
@@ -443,17 +449,15 @@ fill_devices_treeview (GnomePilotCapplet *gpcap)
}
}
-GtkWidget *gnome_pilot_capplet_create_devices_treeview (char *name, char *string1, char *string2, int num1, int num2);
-
-GtkWidget*
-gnome_pilot_capplet_create_devices_treeview (char *name, char *string1, char *string2, int num1, int num2)
+static void
+gpcap_create_devices_treeview (GnomePilotCappletPrivate *priv)
{
- GtkWidget *treeview, *scrolled;
+ GtkWidget *treeview;
+ GtkWidget *scrolled = GTK_WIDGET (gtk_builder_get_object (priv->ui, "devices_treeview"));
GtkTreeSelection *selection;
GtkCellRenderer *renderer;
GtkListStore *model;
- scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
@@ -479,8 +483,6 @@ gnome_pilot_capplet_create_devices_treeview (char *name, char *string1, char *st
gtk_widget_show (scrolled);
gtk_widget_show (treeview);
-
- return scrolled;
}
static void
@@ -551,17 +553,15 @@ set_conduit_pilot (GnomePilotCapplet *gpcap, GPilotPilot *pilot)
check_conduits_buttons (gpcap);
}
-GtkWidget *gnome_pilot_capplet_create_conduit_treeview (char *name, char *string1, char *string2, int num1, int num2);
-
-GtkWidget*
-gnome_pilot_capplet_create_conduit_treeview (char *name, char *string1, char *string2, int num1, int num2)
+static void
+gpcap_create_conduit_treeview (GnomePilotCappletPrivate *priv)
{
- GtkWidget *treeview, *scrolled;
+ GtkWidget *treeview;
+ GtkWidget *scrolled = GTK_WIDGET (gtk_builder_get_object (priv->ui, "conduit_treeview"));
GtkTreeSelection *selection;
GtkCellRenderer *renderer;
GtkListStore *model;
- scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
@@ -587,40 +587,44 @@ gnome_pilot_capplet_create_conduit_treeview (char *name, char *string1, char *st
gtk_widget_show (scrolled);
gtk_widget_show (treeview);
-
- return scrolled;
}
static void
-fill_pilots_menu (GnomePilotCapplet *gpcap)
+fill_pilots_combo (GnomePilotCapplet *gpcap)
{
- GnomePilotCappletPrivate *priv;
- GtkWidget *menu, *menu_item;
- GList *tmp;
- GPilotPilot *pilot = NULL;
-
- priv = gpcap->priv;
-
- menu = gtk_menu_new ();
-
- tmp = priv->state->pilots;
- while (tmp != NULL) {
- if (pilot == NULL)
- pilot = tmp->data;
-
- menu_item = gtk_menu_item_new_with_label (((GPilotPilot*)tmp->data)->name);
- gtk_widget_show (menu_item);
- gtk_object_set_data (GTK_OBJECT (menu_item), "pilot", tmp->data);
- gtk_signal_connect (GTK_OBJECT(menu_item),"activate",
- GTK_SIGNAL_FUNC (gpcap_conduits_choose_pilot),
- gpcap);
- gtk_menu_append (GTK_MENU (menu), menu_item);
-
- tmp = tmp->next;
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (priv->pilots_menu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (priv->pilots_menu), 0);
- set_conduit_pilot (gpcap, pilot);
+ GnomePilotCappletPrivate *priv;
+ GList *tmp;
+ GPilotPilot *pilot = NULL;
+ GtkListStore *store;
+ GtkTreeIter iter;
+
+ priv = gpcap->priv;
+
+
+ store = gtk_list_store_new(1, G_TYPE_STRING);
+
+ tmp = priv->state->pilots;
+ while (tmp != NULL) {
+ if (pilot == NULL)
+ pilot = tmp->data;
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set (store, &iter, 0, ((GPilotPilot*)tmp->data)->name, -1);
+ tmp = tmp->next;
+ }
+
+ gtk_signal_connect (GTK_OBJECT(priv->pilots_combo),"changed",
+ GTK_SIGNAL_FUNC (gpcap_conduits_choose_pilot),
+ gpcap);
+ gtk_combo_box_set_model (GTK_COMBO_BOX (priv->pilots_combo), GTK_TREE_MODEL(store));
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(priv->pilots_combo));
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->pilots_combo),
+ renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (priv->pilots_combo),
+ renderer, "text", 0);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (priv->pilots_combo), 0);
+ set_conduit_pilot (gpcap, pilot);
}
static void
@@ -639,7 +643,7 @@ fill_widgets (GnomePilotCapplet *gpcap)
check_devices_buttons (gpcap);
/* Conduits page */
- fill_pilots_menu (gpcap);
+ fill_pilots_combo (gpcap);
}
void
@@ -728,7 +732,7 @@ gpcap_pilots_add (GtkWidget *widget, gpointer user_data)
gtk_tree_selection_select_iter (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->pilots_treeview)),
&iter);
- fill_pilots_menu (gpcap);
+ fill_pilots_combo (gpcap);
gpcap_save_state (gpcap);
}
@@ -762,7 +766,7 @@ gpcap_pilots_edit (GtkWidget *widget, gpointer user_data)
2, pilot->pilot_username,
-1);
- fill_pilots_menu (gpcap);
+ fill_pilots_combo (gpcap);
gpcap_save_state (gpcap);
}
@@ -790,7 +794,7 @@ gpcap_pilots_delete (GtkWidget *widget, gpointer user_data)
&iter);
priv->state->pilots = g_list_remove (priv->state->pilots, pilot);
- fill_pilots_menu (gpcap);
+ fill_pilots_combo (gpcap);
gpcap_save_state (gpcap);
}
@@ -806,21 +810,39 @@ gpcap_pilots_popup (GtkTreeView *treeview, GdkEventButton *event, gpointer user_
GnomePilotCapplet *gpcap = GNOME_PILOT_CAPPLET (user_data);
GnomePilotCappletPrivate *priv;
- GnomeUIInfo popup [] = {
- GNOMEUIINFO_ITEM_DATA (N_("_Edit this PDA..."),
- N_("Edit the currently selected PDA"),
- gpcap_pilots_edit, gpcap, NULL),
- GNOMEUIINFO_ITEM_DATA (N_("_Delete this PDA"),
- N_("Delete the currently selected PDA"),
- gpcap_pilots_delete, gpcap, NULL),
- GNOMEUIINFO_END
+ GtkActionEntry entries[] = {
+ { "Edit", NULL, N_("_Edit this PDA..."), NULL,
+ N_("Edit the currently selected PDA"), GTK_SIGNAL_FUNC(gpcap_pilots_edit)},
+ { "Delete", NULL, N_("_Delete this PDA"), NULL,
+ N_("Delete the currently selected PDA"), GTK_SIGNAL_FUNC(gpcap_pilots_delete)},
};
+ static const char *ui_description =
+ "<ui>"
+ "<popup name='pilotsPopupMenu'>"
+ " <menuitem action='Edit'/>"
+ " <menuitem action='Delete'/>"
+ "</popup>"
+ "</ui>";
+
+ GtkActionGroup *action_group = gtk_action_group_new ("MenuActions");
+ gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), gpcap);
+
priv = gpcap->priv;
if (priv->pilots_popup == NULL) {
- priv->pilots_popup = gtk_menu_new ();
- gnome_app_fill_menu (GTK_MENU_SHELL (priv->pilots_popup), popup, NULL, TRUE, 0);
+ GtkUIManager *ui_manager = gtk_ui_manager_new ();
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+
+ GError *error = NULL;
+ if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, &error))
+ {
+ g_message ("building menus failed: %s", error->message);
+ g_error_free (error);
+ exit (EXIT_FAILURE);
+ }
+
+ priv->pilots_popup = gtk_ui_manager_get_widget (ui_manager, "/pilotsPopupMenu");
}
return show_popup_menu (treeview, event, GTK_MENU (priv->pilots_popup));
@@ -964,24 +986,42 @@ gpcap_devices_popup (GtkTreeView *treeview, GdkEventButton *event, gpointer user
GnomePilotCapplet *gpcap = GNOME_PILOT_CAPPLET (user_data);
GnomePilotCappletPrivate *priv;
- GnomeUIInfo popup [] = {
- GNOMEUIINFO_ITEM_DATA (N_("_Edit this device..."),
- N_("Edit the currently selected device"),
- gpcap_devices_edit, gpcap, NULL),
- GNOMEUIINFO_ITEM_DATA (N_("_Delete this device"),
- N_("Delete the currently selected device"),
- gpcap_devices_delete, gpcap, NULL),
- GNOMEUIINFO_END
+ GtkActionEntry entries[] = {
+ { "Edit", NULL, N_("_Edit this device..."), NULL,
+ N_("Edit the currently selected device"), GTK_SIGNAL_FUNC(gpcap_devices_edit)},
+ { "Delete", NULL, N_("_Delete this device"), NULL,
+ N_("Delete the currently selected device"), GTK_SIGNAL_FUNC(gpcap_devices_delete)},
};
+ static const char *ui_description =
+ "<ui>"
+ "<popup name='devicesPopupMenu'>"
+ " <menuitem action='Edit'/>"
+ " <menuitem action='Delete'/>"
+ "</popup>"
+ "</ui>";
+
+ GtkActionGroup *action_group = gtk_action_group_new ("MenuActions");
+ gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), gpcap);
+
priv = gpcap->priv;
if (priv->devices_popup == NULL) {
- priv->pilots_popup = gtk_menu_new ();
- gnome_app_fill_menu (GTK_MENU_SHELL (priv->pilots_popup), popup, NULL, TRUE, 0);
+ GtkUIManager *ui_manager = gtk_ui_manager_new ();
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+
+ GError *error = NULL;
+ if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, &error))
+ {
+ g_message ("building menus failed: %s", error->message);
+ g_error_free (error);
+ exit (EXIT_FAILURE);
+ }
+
+ priv->devices_popup = gtk_ui_manager_get_widget (ui_manager, "/devicesPopupMenu");
}
- return show_popup_menu (treeview, event, GTK_MENU (priv->pilots_popup));
+ return show_popup_menu (treeview, event, GTK_MENU (priv->devices_popup));
}
static ConduitState *
@@ -1045,10 +1085,13 @@ gpcap_conduits_choose_pilot (GtkWidget *widget, gpointer user_data)
GnomePilotCapplet *gpcap = GNOME_PILOT_CAPPLET (user_data);
GnomePilotCappletPrivate *priv;
GPilotPilot *pilot;
+ guint index;
priv = gpcap->priv;
+
+ index = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->pilots_combo));
- pilot = gtk_object_get_data (GTK_OBJECT (widget), "pilot");
+ pilot = g_list_nth_data(priv->state->pilots, index);
set_conduit_pilot (gpcap, pilot);
}
@@ -1169,33 +1212,48 @@ gpcap_conduits_popup (GtkTreeView *treeview, GdkEventButton *event, gpointer use
ConduitState *state;
GtkTreePath *path;
gboolean test = FALSE, enabled = FALSE;
-
- GnomeUIInfo popup [] = {
- GNOMEUIINFO_ITEM_DATA (N_("_Enable this conduit"),
- N_("Disable the currently selected conduit"),
- gpcap_conduits_enable, gpcap, NULL),
- GNOMEUIINFO_ITEM_DATA (N_("_Disable this conduit"),
- N_("Enable the currently selected conduit"),
- gpcap_conduits_disable, gpcap, NULL),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_DATA (N_("_Settings..."),
- N_("Modify the currently selected conduit's settings"),
- gpcap_conduits_settings, gpcap, NULL),
-
- GNOMEUIINFO_END
+
+ GtkActionEntry entries[] = {
+ { "Enable", NULL, N_("_Enable this conduit"), NULL,
+ N_("Disable the currently selected conduit"), GTK_SIGNAL_FUNC(gpcap_conduits_enable)},
+ { "Disable", NULL, N_("_Disable this conduit"), NULL,
+ N_("Enable the currently selected conduit"), GTK_SIGNAL_FUNC(gpcap_conduits_disable)},
+ { "Settings", NULL, N_("_Settings..."), NULL,
+ N_("Modify the currently selected conduit's settings"), GTK_SIGNAL_FUNC(gpcap_conduits_settings)},
};
+
+ static const char *ui_description =
+ "<ui>"
+ "<popup name='conduitPopupMenu'>"
+ " <menuitem action='Enable'/>"
+ " <menuitem action='Disable'/>"
+ " <separator/>"
+ " <menuitem action='Settings'/>"
+ "</popup>"
+ "</ui>";
+
+ GtkActionGroup *action_group = gtk_action_group_new ("MenuActions");
+ gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), gpcap);
priv = gpcap->priv;
if (priv->conduit_popup == NULL) {
- priv->conduit_popup = gtk_menu_new ();
- gnome_app_fill_menu (GTK_MENU_SHELL (priv->conduit_popup), popup, NULL, TRUE, 0);
+ GtkUIManager *ui_manager = gtk_ui_manager_new ();
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+
+ GError *error = NULL;
+ if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, &error))
+ {
+ g_message ("building menus failed: %s", error->message);
+ g_error_free (error);
+ exit (EXIT_FAILURE);
+ }
+
+ priv->conduit_popup = gtk_ui_manager_get_widget (ui_manager, "/conduitPopupMenu");
- priv->conduit_popup_enable = popup[0].widget;
- priv->conduit_popup_disable = popup[1].widget;
- priv->conduit_popup_settings = popup[3].widget;
+ priv->conduit_popup_enable = gtk_ui_manager_get_widget (ui_manager, "/conduitPopupMenu/Enable");
+ priv->conduit_popup_disable = gtk_ui_manager_get_widget (ui_manager, "/conduitPopupMenu/Disable");
+ priv->conduit_popup_settings = gtk_ui_manager_get_widget (ui_manager, "/conduitPopupMenu/Settings");
}
diff --git a/capplet/gnome-pilot-capplet.h b/capplet/gnome-pilot-capplet.h
index 372880f..7db42f7 100644
--- a/capplet/gnome-pilot-capplet.h
+++ b/capplet/gnome-pilot-capplet.h
@@ -31,6 +31,7 @@
#define _GNOME_PILOT_CAPPLET_H_
#include <gpilotd/gnome-pilot-client.h>
+#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" {
diff --git a/capplet/gnome-pilot-cdialog.c b/capplet/gnome-pilot-cdialog.c
index 0953c4a..e3f962c 100644
--- a/capplet/gnome-pilot-cdialog.c
+++ b/capplet/gnome-pilot-cdialog.c
@@ -103,7 +103,8 @@ init (GnomePilotCDialog *gpcd)
{
GnomePilotCDialogPrivate *priv;
guint error;
- gchar *objects[] = {"ConduitSettings", NULL};
+ gchar *objects[] = {"ConduitSettings",
+ NULL};
priv = g_new0 (GnomePilotCDialogPrivate, 1);
@@ -160,8 +161,8 @@ get_widgets (GnomePilotCDialog *gpcd)
priv->dialog = GW ("ConduitSettings");
priv->settings_frame = GW ("settings_frame");
- priv->sync_actions = GW ("sync_actions_menu");
- priv->sync_one_actions = GW ("sync_one_actions_menu");
+ priv->sync_actions = GW ("sync_actions_combo");
+ priv->sync_one_actions = GW ("sync_one_actions_combo");
priv->options_frame = GW ("options_frame");
@@ -169,6 +170,7 @@ get_widgets (GnomePilotCDialog *gpcd)
return (priv->dialog
&& priv->settings_frame
&& priv->sync_actions
+ && priv->sync_one_actions
&& priv->options_frame);
}
@@ -176,21 +178,13 @@ static void
init_widgets (GnomePilotCDialog *gpcd)
{
GnomePilotCDialogPrivate *priv;
- GtkWidget *menu;
+ GtkWidget *combo;
GList *l;
priv = gpcd->priv;
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->sync_actions));
- l = GTK_MENU_SHELL (menu)->children;
- while (l != NULL) {
- GtkWidget *menu_item = GTK_WIDGET (l->data);
-
- gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
- GTK_SIGNAL_FUNC (gpcd_action_activated), gpcd);
-
- l = l->next;
- }
+ gtk_signal_connect (GTK_OBJECT (priv->sync_actions), "changed",
+ GTK_SIGNAL_FUNC (gpcd_action_activated), gpcd);
}
static void
@@ -201,9 +195,8 @@ fill_widgets (GnomePilotCDialog *gpcd)
priv = gpcd->priv;
if (priv->state) {
- fill_conduit_sync_type_menu (GTK_OPTION_MENU (priv->sync_actions), priv->state);
- if (priv->state->default_sync_type != GnomePilotConduitSyncTypeCustom)
- fill_conduit_first_sync_type_menu (GTK_OPTION_MENU (priv->sync_one_actions), priv->state);
+ fill_conduit_sync_type_combo (GTK_COMBO_BOX (priv->sync_actions), priv->state);
+ fill_conduit_first_sync_type_combo (GTK_COMBO_BOX (priv->sync_one_actions), priv->state);
if (!priv->state->has_settings) {
gtk_widget_hide (priv->settings_frame);
@@ -226,28 +219,36 @@ GnomePilotConduitSyncType
gnome_pilot_cdialog_sync_type (GnomePilotCDialog *gpcd)
{
GnomePilotCDialogPrivate *priv;
- GtkWidget *menu, *menu_item;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ int sync_type = -1;
priv = gpcd->priv;
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->sync_actions));
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
-
- return GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "sync_type"));
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX(priv->sync_actions));
+ if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(priv->sync_actions), &iter)) {
+ gtk_tree_model_get(model, &iter, 1, &sync_type, -1);
+ }
+
+ return sync_type;
}
GnomePilotConduitSyncType
gnome_pilot_cdialog_first_sync_type (GnomePilotCDialog *gpcd)
{
GnomePilotCDialogPrivate *priv;
- GtkWidget *menu, *menu_item;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ int sync_type = -1;
priv = gpcd->priv;
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->sync_one_actions));
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
-
- return GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "sync_type"));
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX(priv->sync_one_actions));
+ if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(priv->sync_one_actions), &iter)) {
+ gtk_tree_model_get(model, &iter, 1, &sync_type, -1);
+ }
+
+ return sync_type;
}
gboolean
@@ -259,6 +260,7 @@ gnome_pilot_cdialog_run_and_close (GnomePilotCDialog *gpcd, GtkWindow *parent)
priv = gpcd->priv;
gtk_window_set_transient_for (GTK_WINDOW (priv->dialog), parent);
+ fill_conduit_sync_type_combo (GTK_COMBO_BOX (priv->sync_actions), priv->state);
btn = gtk_dialog_run (GTK_DIALOG (priv->dialog));
gtk_widget_hide(priv->dialog);
diff --git a/capplet/gnome-pilot-ddialog.c b/capplet/gnome-pilot-ddialog.c
index e3e2ca3..c149513 100644
--- a/capplet/gnome-pilot-ddialog.c
+++ b/capplet/gnome-pilot-ddialog.c
@@ -47,7 +47,7 @@ struct _GnomePilotDDialogPrivate
GtkWidget *device_port;
GtkWidget *device_port_combo;
GtkWidget *device_port_label;
- GtkWidget *device_speed;
+ GtkWidget *device_speed_combo;
GtkWidget *device_speed_label;
GtkWidget *device_timeout;
GtkWidget *device_serial;
@@ -116,7 +116,11 @@ init (GnomePilotDDialog *gpdd)
{
GnomePilotDDialogPrivate *priv;
guint error;
- gchar *objects[] = {"DeviceSettings", NULL};
+ GError *err = NULL;
+ gchar *objects[] = {"DeviceSettings",
+ "timeout_adjustment",
+ "device_port_store",
+ NULL};
priv = g_new0 (GnomePilotDDialogPrivate, 1);
@@ -126,9 +130,9 @@ init (GnomePilotDDialog *gpdd)
priv->ui = gtk_builder_new ();
error = gtk_builder_add_objects_from_file (priv->ui, "gpilotd-capplet.ui", objects, NULL);
if (error == 0) {
- error = gtk_builder_add_objects_from_file (priv->ui, UIDATADIR "/gpilotd-capplet.ui", objects, NULL);
+ error = gtk_builder_add_objects_from_file (priv->ui, UIDATADIR "/gpilotd-capplet.ui", objects, &err);
if (error == 0) {
- g_message ("gnome-pilot-ddialog init(): Could not load the GtkBuilder UI file!");
+ g_message ("gnome-pilot-ddialog init(): Could not load the GtkBuilder UI file: %s", err->message);
goto error;
}
}
@@ -166,6 +170,8 @@ static gboolean
get_widgets (GnomePilotDDialog *gpdd)
{
GnomePilotDDialogPrivate *priv;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
priv = gpdd->priv;
@@ -174,10 +180,11 @@ get_widgets (GnomePilotDDialog *gpdd)
priv->dialog = GW ("DeviceSettings");
priv->device_name = GW ("device_name_entry");
- priv->device_port = GW ("device_port_entry");
priv->device_port_label = GW ("device_port_label");
priv->device_port_combo = GW ("device_port_combo");
- priv->device_speed = GW ("device_speed_menu");
+ priv->device_port = gtk_bin_get_child (
+ GTK_BIN(priv->device_port_combo));
+ priv->device_speed_combo = GW ("device_speed_combo");
priv->device_speed_label = GW ("device_speed_label");
priv->device_timeout = GW ("timeout_spinner");
priv->device_serial = GW ("serial_radio");
@@ -186,22 +193,34 @@ get_widgets (GnomePilotDDialog *gpdd)
priv->device_network = GW ("network_radio");
priv->device_bluetooth = GW ("bluetooth_radio");
+ /* Doing the cell layout in glade .ui file seemed to result
+ * in duplicated text. Probably a bug in glade/gtkbuilder?
+ */
+ // model = GTK_TREE_MODEL(gtk_list_store_new (1, G_TYPE_STRING));
+ model = GTK_TREE_MODEL(gtk_builder_get_object (priv->ui,
+ "device_port_store"));
+ gtk_combo_box_set_model (GTK_COMBO_BOX (priv->device_port_combo), model);
+ gtk_combo_box_entry_set_text_column(
+ GTK_COMBO_BOX_ENTRY (priv->device_port_combo), 0);
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(priv->device_port_combo));
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->device_port_combo),
+ renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (priv->device_port_combo),
+ renderer, "text", 0);
#ifdef PILOT_LINK_0_12
/* usb: (libusb) pseudo-device is available from pilot-link 0.12.0 */
- priv->libusb_list = NULL;
- priv->libusb_label = gtk_list_item_new_with_label ("usb:");
- gtk_widget_show(priv->libusb_label);
- priv->libusb_list = g_list_append(priv->libusb_list,
- priv->libusb_label);
- gtk_list_insert_items (GTK_LIST((GTK_COMBO(priv->device_port_combo))->list),
- priv->libusb_list, 1);
+ gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, "usb:", -1);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->device_usb), 1);
#endif
-
+ fill_speed_combo(GTK_COMBO_BOX(priv->device_speed_combo));
+
#undef GW
return (priv->dialog
&& priv->device_name
&& priv->device_port
- && priv->device_speed
+ && priv->device_speed_combo
&& priv->device_timeout
&& priv->device_serial
&& priv->device_usb
@@ -219,7 +238,7 @@ map_widgets (GnomePilotDDialog *gpdd)
gtk_object_set_data (GTK_OBJECT (gpdd), "port_entry", priv->device_port);
gtk_object_set_data (GTK_OBJECT (gpdd), "name_entry", priv->device_name);
- gtk_object_set_data (GTK_OBJECT (gpdd), "speed_menu", priv->device_speed);
+ gtk_object_set_data (GTK_OBJECT (gpdd), "speed_combo", priv->device_speed_combo);
gtk_object_set_data (GTK_OBJECT (gpdd), "irda_radio", priv->device_serial);
gtk_object_set_data (GTK_OBJECT (gpdd), "usb_radio", priv->device_usb);
gtk_object_set_data (GTK_OBJECT (gpdd), "irda_radio", priv->device_irda);
@@ -268,6 +287,8 @@ fill_widgets (GnomePilotDDialog *gpdd)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->device_bluetooth),
priv->device->type == PILOT_DEVICE_BLUETOOTH);
set_widget_visibility_by_type(gpdd, priv->device->type);
+ speed_combo_set_speed(GTK_COMBO_BOX(priv->device_speed_combo),
+ priv->device->speed);
}
}
@@ -353,7 +374,7 @@ set_widget_visibility_by_type(GnomePilotDDialog *gpdd, int type) {
enable_extra_widgets);
gtk_widget_set_sensitive(priv->device_port_label,
enable_extra_widgets);
- gtk_widget_set_sensitive(priv->device_speed,
+ gtk_widget_set_sensitive(priv->device_speed_combo,
enable_extra_widgets);
gtk_widget_set_sensitive(priv->device_speed_label,
enable_extra_widgets);
diff --git a/capplet/gnome-pilot-pdialog.c b/capplet/gnome-pilot-pdialog.c
index 2a49bc9..0dde650 100644
--- a/capplet/gnome-pilot-pdialog.c
+++ b/capplet/gnome-pilot-pdialog.c
@@ -47,6 +47,8 @@ struct _GnomePilotPDialogPrivate
GPilotPilot *pilot;
GtkWidget *dialog;
+
+ gchar *errstr;
GtkWidget *pilot_username;
GtkWidget *pilot_id;
@@ -132,7 +134,10 @@ init (GnomePilotPDialog *gppd)
{
GnomePilotPDialogPrivate *priv;
guint error;
- gchar *objects[] = {"PilotSettings", NULL};
+ gchar *objects[] = {"PilotSettings",
+ "timeout_adjustment",
+ "pilot_charset_store",
+ NULL};
priv = g_new0 (GnomePilotPDialogPrivate, 1);
@@ -218,7 +223,24 @@ get_widgets (GnomePilotPDialog *gppd)
priv->pilot_charset_label = GW ("pilot_charset_label");
priv->pilot_charset_combo = GW ("pilot_charset_combo");
#ifdef PILOT_LINK_0_12
- priv->pilot_charset = GW ("pilot_charset_entry");
+ priv->pilot_charset = gtk_bin_get_child (
+ GTK_BIN(priv->pilot_charset_combo));
+
+ /* bug in gtkbuilder? couldn't get the list store to work right with glade,
+ * so I do it here.
+ */
+ GtkTreeModel *model = GTK_TREE_MODEL(gtk_builder_get_object (priv->ui,
+ "pilot_charset_store"));
+ gtk_combo_box_set_model (GTK_COMBO_BOX (priv->pilot_charset_combo), model);
+ gtk_combo_box_entry_set_text_column(
+ GTK_COMBO_BOX_ENTRY (priv->pilot_charset_combo), 0);
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(priv->pilot_charset_combo));
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->pilot_charset_combo),
+ renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (priv->pilot_charset_combo),
+ renderer, "text", 0);
+
#endif
#undef GW
@@ -303,7 +325,6 @@ gnome_pilot_pdialog_run_and_close (GnomePilotPDialog *gppd, GtkWindow *parent)
{
GnomePilotPDialogPrivate *priv;
gint btn;
- gchar *IAMHERE;
priv = gppd->priv;
@@ -315,13 +336,17 @@ gnome_pilot_pdialog_run_and_close (GnomePilotPDialog *gppd, GtkWindow *parent)
if(
#ifdef PILOT_LINK_0_12
check_pilot_charset(gtk_entry_get_text(
- GTK_ENTRY(priv->pilot_charset)), &IAMHERE) &&
+ GTK_ENTRY(priv->pilot_charset)), &priv->errstr) &&
#endif
check_base_directory(gtk_entry_get_text(
- GTK_ENTRY(priv->pilot_basedir)), &IAMHERE)) {
+ GTK_ENTRY(priv->pilot_basedir)), &priv->errstr)) {
read_pilot_config (GTK_OBJECT (gppd),
priv->pilot);
break;
+ } else {
+ error_dialog (GTK_WINDOW (priv->dialog), priv->errstr);
+ g_free(priv->errstr);
+ priv->errstr = NULL;
}
} else {
break;
diff --git a/capplet/gpilotd-capplet.ui b/capplet/gpilotd-capplet.ui
index b449487..9e465ca 100644
--- a/capplet/gpilotd-capplet.ui
+++ b/capplet/gpilotd-capplet.ui
@@ -45,6 +45,29 @@
</row>
</data>
</object>
+ <object class="GtkListStore" id="device_port_store">
+ <columns>
+ <!-- column-name item -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0">/dev/pilot</col>
+ </row>
+ <row>
+ <col id="0">/dev/ttyUSB0</col>
+ </row>
+ <row>
+ <col id="0">/dev/ttyUSB1</col>
+ </row>
+ <row>
+ <col id="0">/dev/ttyS0</col>
+ </row>
+ <row>
+ <col id="0">/dev/ttyS1</col>
+ </row>
+ </data>
+ </object>
<object class="GtkListStore" id="pilot_charset_store">
<columns>
<!-- column-name item -->
@@ -126,9 +149,14 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
- <object class="GtkTreeView" id="pilots_treeview">
+ <object class="GtkScrolledWindow" id="pilots_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">0</property>
@@ -210,9 +238,14 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
- <object class="GtkTreeView" id="devices_treeview">
+ <object class="GtkScrolledWindow" id="devices_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">0</property>
@@ -460,10 +493,15 @@
</packing>
</child>
<child>
- <object class="GtkTreeView" id="conduit_treeview">
+ <object class="GtkScrolledWindow" id="conduit_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
- </object>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
</child>
</object>
<packing>
@@ -1113,8 +1151,8 @@ Since you have more than one connection device defined for this computer you nee
<child>
<object class="GtkComboBoxEntry" id="pilot_charset_combo">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="model">pilot_charset_store</property>
- <property name="active">0</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
@@ -1404,7 +1442,7 @@ Since you have more than one connection device defined for this computer you nee
<child>
<object class="GtkComboBox" id="device_speed_combo">
<property name="visible">True</property>
- <property name="model">device_speed_store</property>
+ <property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -1417,6 +1455,12 @@ Since you have more than one connection device defined for this computer you nee
<child>
<object class="GtkComboBoxEntry" id="device_port_combo">
<property name="visible">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext3"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -1511,20 +1555,12 @@ Press 'Cancel' to exit.</property>
<object class="GtkComboBoxEntry" id="assistant_device_port_combo">
<property name="visible">True</property>
<property name="can_focus">True</property>
-<!-- <property name="active">1</property> -->
-<!-- <property
-name="model">assistant_device_port_store</property> -->
<child>
- <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <object class="GtkCellRendererText" id="cellrenderertext4"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
-<!-- <child internal-child="accessible">
- <object class="AtkObject" id="assistant_device_port_combo-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Port</property>
- </object>
- </child> -->
</object>
<packing>
<property name="left_attach">1</property>
@@ -1538,15 +1574,15 @@ name="model">assistant_device_port_store</property> -->
<object class="GtkComboBox" id="assistant_device_speed_combo">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="active">3</property>
<property name="model">assistant_device_speed_store</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext3"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <property name="active">3</property>
</object>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext5"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@@ -1758,8 +1794,7 @@ name="model">assistant_device_port_store</property> -->
<property name="visible">True</property>
</object>
<packing>
- <property name="title" translatable="yes">Please fix the
-following problem...</property>
+ <property name="title" translatable="yes">Please fix the following problem...</property>
<property name="header_image">gnome-palm.png</property>
</packing>
</child>
@@ -1944,7 +1979,7 @@ following problem...</property>
<property name="can_focus">True</property>
<property name="model">assistant_pilot_charset_store</property>
<child>
- <object class="GtkCellRendererText" id="cellrenderertext4"/>
+ <object class="GtkCellRendererText" id="cellrenderertext6"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
diff --git a/capplet/gpilotd-control-applet.c b/capplet/gpilotd-control-applet.c
index 91ec7cc..04556a7 100644
--- a/capplet/gpilotd-control-applet.c
+++ b/capplet/gpilotd-control-applet.c
@@ -30,8 +30,6 @@
#include <config.h>
#include <ctype.h>
-#include <libgnomeui/gnome-window-icon.h>
-#include <libgnomeui/gnome-ui-init.h>
#include <gpilotd/gnome-pilot-client.h>
#include "gnome-pilot-assistant.h"
@@ -76,34 +74,32 @@ main (int argc, char *argv[])
GnomePilotCapplet *gpcap = NULL;
gboolean assistant_on = FALSE, assistant_prog = FALSE;
- struct poptOption options[] = {
- {"assistant", '\0', POPT_ARG_NONE, &assistant_on, 0, "Start assistant only", NULL}, /* FIXME: Make N_() translatable after string freeze */
+ GOptionEntry options[] = {
+ {"assistant", '\0', 0, G_OPTION_ARG_NONE, &assistant_on, "Start assistant only", NULL}, /* FIXME: Make N_() translatable after string freeze */
- {NULL, '\0', 0, NULL, 0, NULL, NULL}
+ {NULL}
};
+ GError *err;
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- if (argc > 1 && strcmp (argv[1], "--druid") == 0) {
- gnome_init_with_popt_table ("gpilot-control-applet",
- VERSION, argc, argv,
- options,0,NULL);
+ if (!gtk_init_with_args (&argc, &argv, _(" - configure gnome-pilot settings"),
+ options, PACKAGE, &err)) {
+ g_error (_("Error initializing gpilotd capplet : %s"), err->message);
+ exit (1);
+ }
+ if (assistant_on) {
assistant_on = TRUE;
assistant_prog = TRUE;
- } else {
- /* we're a capplet (we get CORBA for free from capplet_init) */
- switch (gnome_init_with_popt_table ("gpilotd-control-applet", VERSION, argc, argv,
- options,0,NULL)) {
- case 1: return 0; break;
- case -1: g_error (_("Error initializing gpilotd capplet")); break;
- default: break;
- }
}
- gnome_window_icon_set_default_from_file (GNOME_ICONDIR"/gnome-palm.png");
+ if (!gtk_window_set_default_icon_from_file (GNOME_ICONDIR "/gnome-palm.png", &err)) {
+ g_error (_("Error initializing gpilotd capplet : %s"), err->message);
+ exit (1);
+ }
/* put all code to set things up in here */
if (loadPilotState (&state) < 0) {
diff --git a/capplet/util.c b/capplet/util.c
index b8b4ebf..c95759a 100644
--- a/capplet/util.c
+++ b/capplet/util.c
@@ -31,77 +31,176 @@
#include <iconv.h>
#include <gtk/gtk.h>
+static const guint speedList[] = {9600, 19200, 38400, 57600, 115200, 0};
+#define DEFAULT_SPEED_INDEX 3 /* Default to 57600 */
+
+void
+fill_speed_combo (GtkComboBox *option_combo)
+{
+ gint i = 0;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ gchar *text;
+
+ g_return_if_fail (option_combo != NULL);
+ g_return_if_fail (GTK_IS_COMBO_BOX (option_combo));
+
+ model = gtk_combo_box_get_model (option_combo);
+ if (model != NULL)
+ /* tree model not empty -- don't reinitialise */
+ return;
+
+ model = GTK_TREE_MODEL(gtk_list_store_new (1, G_TYPE_STRING));
+ i = 0;
+ while (speedList[i] != 0) {
+ text = g_strdup_printf ("%d", speedList[i]);
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, text, -1);
+ g_free(text);
+ i++;
+ }
+ gtk_combo_box_set_model (option_combo, model);
+
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(option_combo));
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (option_combo),
+ renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (option_combo),
+ renderer, "text", 0);
+
+ gtk_combo_box_set_active(option_combo, DEFAULT_SPEED_INDEX);
+}
+
+/* return false if an invalid speed was supplied */
+gboolean
+speed_combo_set_speed (GtkComboBox *option_combo, int speed)
+{
+ gint i;
+
+ i = 0;
+ while(speedList[i] != 0) {
+ if (speedList[i] == speed) {
+ gtk_combo_box_set_active(option_combo, i);
+ return TRUE;
+ }
+ i++;
+ }
+ return FALSE;
+}
+
+int
+speed_combo_get_speed (GtkComboBox *option_combo)
+{
+ return speedList[gtk_combo_box_get_active(option_combo)];
+}
+
void
-fill_conduit_sync_type_menu (GtkOptionMenu *option_menu, ConduitState *state)
+fill_conduit_sync_type_combo (GtkComboBox *option_combo, ConduitState *state)
{
- GtkWidget *menu_item;
- GtkMenu *menu;
+ int current = 0;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
GList *tmp;
- int index, current=0;
-
- menu = GTK_MENU (gtk_menu_new ());
+ int index;
- menu_item = gtk_menu_item_new_with_label(_("Disabled"));
- gtk_widget_show(menu_item);
- gtk_object_set_data (GTK_OBJECT (menu_item), "sync_type", GINT_TO_POINTER (GnomePilotConduitSyncTypeNotSet));
- gtk_menu_append (menu, menu_item);
+ g_return_if_fail (option_combo != NULL);
+ g_return_if_fail (GTK_IS_COMBO_BOX (option_combo));
+
+ model = gtk_combo_box_get_model (option_combo);
+
+ if (model != NULL) {
+ /* we have to set combo box active row to match current sync state,
+ * so just as easy to start again.
+ */
+ gtk_list_store_clear(GTK_LIST_STORE(model));
+ } else {
+ model = GTK_TREE_MODEL(gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
+ }
+
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, _("Disabled"),
+ 1, GnomePilotConduitSyncTypeNotSet, -1);
tmp = state->valid_synctypes;
if (tmp == NULL && state->default_sync_type == GnomePilotConduitSyncTypeCustom ) {
- menu_item = gtk_menu_item_new_with_label(_("Enabled"));
- gtk_widget_show(menu_item);
- gtk_object_set_data (GTK_OBJECT (menu_item), "sync_type", GINT_TO_POINTER (state->default_sync_type));
- gtk_menu_append (menu, menu_item);
- if (state->sync_type == state->default_sync_type)
- current = 1;
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, _("Enabled"),
+ 1, state->default_sync_type, -1);
+ if (state->sync_type == state->default_sync_type)
+ current = 1;
} else {
- for (index = 0; tmp != NULL; tmp = tmp->next, index++) {
- gint value = GPOINTER_TO_INT (tmp->data);
-
- menu_item = gtk_menu_item_new_with_label (sync_type_to_str (value));
- gtk_widget_show (menu_item);
- gtk_object_set_data (GTK_OBJECT (menu_item), "sync_type", GINT_TO_POINTER (value));
- gtk_menu_append (menu,menu_item);
- if (value == state->sync_type)
+ for (index = 0; tmp != NULL; tmp = tmp->next, index++) {
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ 0, sync_type_to_str(GPOINTER_TO_INT (tmp->data)),
+ 1, GPOINTER_TO_INT(tmp->data), -1);
+ if (GPOINTER_TO_INT(tmp->data) == state->sync_type)
current = index + 1;
}
}
-
+ gtk_combo_box_set_model (option_combo, model);
+
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(option_combo));
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (option_combo),
+ renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (option_combo),
+ renderer, "text", 0);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), GTK_WIDGET (menu));
- gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), current);
+ gtk_combo_box_set_active(option_combo, current);
}
void
-fill_conduit_first_sync_type_menu (GtkOptionMenu *option_menu, ConduitState *state)
+fill_conduit_first_sync_type_combo (GtkComboBox *option_combo, ConduitState *state)
{
- GtkWidget *menu_item;
- GtkMenu *menu;
- GList *tmp;
- int index, current=0;
-
- menu = GTK_MENU (gtk_menu_new ());
+ int current = 0;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GList *tmp = NULL;
+ int index;
+
+ g_return_if_fail (option_combo != NULL);
+ g_return_if_fail (GTK_IS_COMBO_BOX (option_combo));
+
+ model = gtk_combo_box_get_model (option_combo);
+ if (model != NULL) {
+ /* we have to set combo box active row to match current sync state,
+ * so just as easy to start again.
+ */
+ gtk_list_store_clear(GTK_LIST_STORE(model));
+ } else {
+ model = GTK_TREE_MODEL(gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
+ }
- menu_item = gtk_menu_item_new_with_label(_("None"));
- gtk_widget_show(menu_item);
- gtk_object_set_data (GTK_OBJECT (menu_item), "sync_type", GINT_TO_POINTER (GnomePilotConduitSyncTypeNotSet));
- gtk_menu_append (menu, menu_item);
+ model = GTK_TREE_MODEL(gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
- tmp = state->valid_synctypes;
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, _("None"),
+ 1, GnomePilotConduitSyncTypeNotSet, -1);
+
+ if (state->default_sync_type != GnomePilotConduitSyncTypeCustom) {
+ tmp = state->valid_synctypes;
+ }
for (index = 0; tmp != NULL; tmp = tmp->next, index++) {
- gint value = GPOINTER_TO_INT (tmp->data);
-
- menu_item = gtk_menu_item_new_with_label (sync_type_to_str (value));
- gtk_widget_show (menu_item);
- gtk_object_set_data (GTK_OBJECT (menu_item), "sync_type", GINT_TO_POINTER (value));
- gtk_menu_append (menu,menu_item);
- if (value == state->first_sync_type)
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ 0, sync_type_to_str(GPOINTER_TO_INT (tmp->data)),
+ 1, GPOINTER_TO_INT(tmp->data), -1);
+ if (GPOINTER_TO_INT(tmp->data) == state->sync_type)
current = index + 1;
}
+ gtk_combo_box_set_model (option_combo, model);
+
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(option_combo));
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (option_combo),
+ renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (option_combo),
+ renderer, "text", 0);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), GTK_WIDGET (menu));
- gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), current);
+ gtk_combo_box_set_active(option_combo, current);
}
gboolean
@@ -241,11 +340,11 @@ get_default_device (PilotState *state)
GPilotDevice *device = g_new0 (GPilotDevice, 1);
device->name = next_cradle_name (state);
- device->port = g_strdup ("/dev/pilot");
+ device->port = g_strdup ("usb:");
/* XXX */
- // device->speed = speedList[DEFAULT_SPEED_INDEX];
- device->type = PILOT_DEVICE_SERIAL;
- device->timeout = 2;
+ device->speed = speedList[DEFAULT_SPEED_INDEX];
+ device->type = PILOT_DEVICE_USB_VISOR;
+ device->timeout = 0;
return device;
}
@@ -509,9 +608,8 @@ check_pilot_charset (const gchar *charset, gchar **errstr)
void
read_device_config (GtkObject *object, GPilotDevice* device)
{
- GtkWidget *port_entry, *speed_combo, *item, *name_entry;
+ GtkWidget *port_entry, *speed_combo, *name_entry;
GtkWidget *usb_radio, *irda_radio, *network_radio, *timeout_spinner, *bluetooth_radio;
- GtkTreeIter iter;
g_return_if_fail (device!= NULL);
@@ -533,10 +631,7 @@ read_device_config (GtkObject *object, GPilotDevice* device)
device->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (name_entry)));
if (device->name == NULL) device->name = g_strdup ("Cradle");
- gtk_combo_box_get_active_iter (GTK_COMBO_BOX (speed_combo), &iter);
- gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX (speed_combo)),
- &iter, 0, &item, -1);
- sscanf((gchar *)item, "%d", &device->speed);
+ device->speed = speed_combo_get_speed(GTK_COMBO_BOX(speed_combo));
device->type = PILOT_DEVICE_SERIAL;
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (usb_radio))) {
@@ -609,7 +704,6 @@ save_config_and_restart (GnomePilotClient *gpc, PilotState *state)
gboolean
check_device_settings (GPilotDevice *device, char **errstr)
{
- char *str;
#ifndef WITH_HAL
struct stat buf;
char *usbdevicesfile_str ="/proc/bus/usb/devices";
diff --git a/capplet/util.h b/capplet/util.h
index f1d4649..3a2eb47 100644
--- a/capplet/util.h
+++ b/capplet/util.h
@@ -26,9 +26,12 @@
#include "pilot.h"
/* Gui routines */
-void fill_synctype_menu (GtkOptionMenu *optionMenu, GnomePilotConduitSyncType type);
-void fill_conduit_sync_type_menu (GtkOptionMenu *option_menu, ConduitState *state);
-void fill_conduit_first_sync_type_menu (GtkOptionMenu *option_menu, ConduitState *state);
+void fill_speed_combo (GtkComboBox *option_combo);
+int speed_combo_get_speed (GtkComboBox *option_combo);
+gboolean speed_combo_set_speed (GtkComboBox *option_combo, int speed);
+
+void fill_conduit_sync_type_combo (GtkComboBox *option_combo, ConduitState *state);
+void fill_conduit_first_sync_type_combo (GtkComboBox *option_combo, ConduitState *state);
gboolean show_popup_menu (GtkTreeView *treeview, GdkEventButton *event, GtkMenu *menu);
/* Filtering callbacks */
@@ -52,6 +55,7 @@ gchar *next_pilot_name (PilotState *state);
const gchar* sync_type_to_str (GnomePilotConduitSyncType t);
const gchar* device_type_to_str (GPilotDeviceType t);
const gchar* display_sync_type_name (gboolean enabled, GnomePilotConduitSyncType sync_type);
+int speedlist_int_to_index (int speed);
gboolean check_pilot_info (GPilotPilot* pilot1, GPilotPilot *pilot2);
gboolean check_device_info (GPilotDevice* device1, GPilotDevice *device2);
diff --git a/conduits/backup/backup_conduit.c b/conduits/backup/backup_conduit.c
index 2a4a892..deaa368 100644
--- a/conduits/backup/backup_conduit.c
+++ b/conduits/backup/backup_conduit.c
@@ -133,7 +133,7 @@ load_configuration(GnomePilotConduit *conduit,
g_strdup(exclude_files[i]));
g_free(exclude_files[i]);
}
- g_strfreev(exclude_files);
+ g_free(exclude_files);
}
if ((*c)->backup_dir == NULL) {
@@ -191,7 +191,7 @@ static void
save_configuration(ConduitCfg *c)
{
gchar *iPilot;
- const gchar **exclude = NULL;
+ const gchar **exclude;
GList *iterator;
guint i = 0;
GKeyFile *kfile;
@@ -213,10 +213,14 @@ save_configuration(ConduitCfg *c)
g_key_file_set_boolean (kfile, iPilot, "updated_only",c->updated_only);
g_key_file_set_boolean (kfile, iPilot, "remove_deleted",c->remove_deleted);
g_key_file_set_integer (kfile, iPilot, "no_of_backups",c->no_of_backups);
- g_key_file_set_string_list (kfile, iPilot, "exclude_files", exclude, i);
+ if (i != 0) {
+ g_key_file_set_string_list (kfile, iPilot, "exclude_files", exclude, i);
+ g_free(exclude);
+ } else {
+ g_key_file_set_string (kfile, iPilot, "exclude_files", "");
+ }
g_free(iPilot);
- g_free(exclude);
save_backup_kfile (kfile);
g_key_file_free (kfile);
diff --git a/conduits/file/gpilot_install_file.c b/conduits/file/gpilot_install_file.c
index 564f7ad..bd08059 100644
--- a/conduits/file/gpilot_install_file.c
+++ b/conduits/file/gpilot_install_file.c
@@ -21,7 +21,6 @@
#include "config.h"
#include <gtk/gtk.h>
-#include <libgnomeui/gnome-messagebox.h>
#include <libgnomeui/gnome-ui-init.h>
#include <gpilotd/gnome-pilot-client.h>
@@ -38,15 +37,17 @@ int handle;
GtkWidget *dialog;
-int now = 0, later = 0;
+gboolean now = FALSE, later = FALSE;
char *debug_modules = NULL;
-char *pilot_arg=NULL;
-
-static const struct poptOption options[] = {
- {"now", 'n', POPT_ARG_NONE, &now, 0, N_("Install immediately"), NULL},
- {"later", 'l', POPT_ARG_NONE, &later, 0, N_("Install delayed"), NULL},
- {"pilot", 'p', POPT_ARG_STRING, &pilot_arg, 0, N_("PDA to install to"), N_("PDA")},
- {NULL, '\0', 0, NULL, 0} /* end the list */
+gchar *pilot_arg=NULL;
+gchar **filenames;
+
+static GOptionEntry options[] = {
+ {"now", 'n', 0, G_OPTION_ARG_NONE, &now, N_("Install immediately"), NULL},
+ {"later", 'l', 0, G_OPTION_ARG_NONE, &later, N_("Install delayed"), NULL},
+ {"pilot", 'p', 0, G_OPTION_ARG_STRING, &pilot_arg, N_("PDA to install to"), N_("PDA")},
+ {G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, N_("[FILE...]"), N_("list of files")},
+ {NULL}
};
static void
@@ -82,9 +83,9 @@ main (int argc, char *argv[])
{
int err, i;
GNOME_Pilot_Survival survive;
- poptContext pctx;
GList *pilots = NULL;
- const char **args;
+ GOptionContext *option_context;
+ GnomeProgram *program;
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
@@ -95,9 +96,18 @@ main (int argc, char *argv[])
exit (1);
}
- gnome_init_with_popt_table ("gpilotd-install-file", "1.0",
- argc, argv, options, 0, &pctx);
-
+ option_context = g_option_context_new (PACKAGE);
+ g_option_context_add_main_entries (option_context, options, NULL);
+ program = gnome_program_init(PACKAGE, VERSION, LIBGNOMEUI_MODULE,
+ argc, argv,
+ GNOME_PARAM_GOPTION_CONTEXT, option_context,
+ GNOME_PARAM_NONE);
+
+ if (program == NULL) {
+ g_error (_("Error initializing gpilotd"));
+ exit (1);
+ }
+
gpc = GNOME_PILOT_CLIENT (gnome_pilot_client_new ());
gtk_object_ref (GTK_OBJECT (gpc));
gtk_object_sink (GTK_OBJECT (gpc));
@@ -122,27 +132,23 @@ main (int argc, char *argv[])
i=0;
- args = poptGetArgs (pctx);
-
- while (args && args[i]!=NULL) {
+ while (filenames && filenames[i]!=NULL) {
gint err;
err = gnome_pilot_client_install_file (gpc,
pilots->data, /* get first pilot */
- args[i],
+ filenames[i],
survive,
0,
&handle);
if (err == GPILOTD_OK) {
handles = g_slist_prepend (handles,GINT_TO_POINTER(handle));
- notfailed = g_slist_prepend (notfailed, (void *) args[i]);
+ notfailed = g_slist_prepend (notfailed, (void *) filenames[i]);
} else {
- failed = g_slist_prepend (failed, (void *) args[i]);
+ failed = g_slist_prepend (failed, (void *) filenames[i]);
}
i++;
}
- poptFreeContext (pctx);
-
if (!later) {
gchar *message;
diff --git a/configure.in b/configure.in
index d111542..ca97837 100644
--- a/configure.in
+++ b/configure.in
@@ -153,8 +153,10 @@ dnl ******************************
LIBXML_REQUIRED="libxml-2.0"
LIBGNOME_REQUIRED="libgnome-2.0 >= 2.0.0"
LIBGNOMEUI_REQUIRED="libgnomeui-2.0 >= 2.0.0"
+LIBGTK_REQUIRED="gtk+-2.0 >= 2.13.0"
ORBIT_REQUIRED="ORBit-2.0 >= 2.0.0"
LIBBONOBO_REQUIRED="libbonobo-2.0 >= 2.0.0"
+LIBBONOBOUI_REQUIRED="libbonoboui-2.0 >= 2.0.0"
BONOBO_ACTIVATION_REQUIRED="bonobo-activation-2.0 >= 1.0.3"
LIBPANELAPPLET_REQUIRED="libpanelapplet-2.0 >= 2.0.6"
GCONF_REQUIRED="gconf-2.0"
@@ -164,11 +166,12 @@ PKG_CHECK_MODULES(GNOME_PILOT,
$LIBXML_REQUIRED
$LIBGNOME_REQUIRED
$LIBGNOMEUI_REQUIRED
+ $LIBGTK_REQUIRED
$LIBBONOBO_REQUIRED
+ $LIBBONOBOUI_REQUIRED
$ORBIT_REQUIRED
$BONOBO_ACTIVATION_REQUIRED
$GNOMEVFS_REQUIRED
- $GCONF_REQUIRED
])
GNOME_PILOT_CFLAGS="$GNOME_PILOT_CFLAGS $PISOCK_CFLAGS"
diff --git a/gpilotd/gnome-pilot-config.c b/gpilotd/gnome-pilot-config.c
index e0f3e00..2432f53 100644
--- a/gpilotd/gnome-pilot-config.c
+++ b/gpilotd/gnome-pilot-config.c
@@ -35,7 +35,7 @@
#define IS_STR_SET(x) (x != NULL && x[0] != '\0')
static void
-migarate_conf (const gchar *old, const gchar *new)
+migrate_conf (const gchar *old, const gchar *new)
{
gchar *basename = g_path_get_dirname (new);
@@ -74,7 +74,7 @@ get_kfile (const gchar *conf)
old = g_build_filename (homedir, OLD_PREFIX, conf, NULL);
new = g_build_filename (homedir, NEW_PREFIX, conf, NULL);
- migarate_conf (old, new);
+ migrate_conf (old, new);
g_key_file_load_from_file (kfile, new, G_KEY_FILE_NONE, NULL);
g_key_file_set_list_separator (kfile, ' ');
diff --git a/gpilotd/gpilotd.c b/gpilotd/gpilotd.c
index 0e9e0a6..11bc801 100644
--- a/gpilotd/gpilotd.c
+++ b/gpilotd/gpilotd.c
@@ -29,7 +29,8 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <libgnomeui/gnome-ui-init.h>
+#include <libgnomeui/libgnomeui.h>
+#include <libgnome/libgnome.h>
/* for crypt () */
#ifdef USE_XOPEN_SOURCE
@@ -1669,6 +1670,8 @@ dump_build_info (void)
int
main (int argc, char *argv[])
{
+ GnomeProgram *program;
+
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -1681,7 +1684,9 @@ main (int argc, char *argv[])
g_message ("%s %s starting...",PACKAGE,VERSION);
dump_build_info ();
- gnome_init (PACKAGE, VERSION, argc, argv);
+ /* gtk_init(&argc, &argv);*/
+ program = gnome_program_init (PACKAGE, VERSION,
+ LIBGNOMEUI_MODULE, argc, argv, GNOME_PARAM_NONE);
#ifdef WITH_HAL
if ((hal_ctx = gpilotd_hal_init ()) != NULL)
diff --git a/gpilotd/orbit_daemon_glue.c b/gpilotd/orbit_daemon_glue.c
index 79b3d34..ea7ff05 100644
--- a/gpilotd/orbit_daemon_glue.c
+++ b/gpilotd/orbit_daemon_glue.c
@@ -1275,10 +1275,11 @@ gpilotd_corba_get_databases_from_cache(GNOME_Pilot_Daemon obj,
strcpy(pilots->_buffer[i],databases[i]);
g_free(databases[i]);
}
- g_strfreev (databases);
+ g_free (databases);
g_key_file_free (kfile);
return pilots;
} else {
+ g_key_file_free (kfile);
return empty_StringSequence();
}
}
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 16077cb..5be03f6 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,9 +6,9 @@ applet/pilot.c
applet/pilot.schemas.in
capplet/gnome-pilot-capplet.c
capplet/gnome-pilot-cdialog.c
-capplet/gnome-pilot-druid.c
+capplet/gnome-pilot-assistant.c
capplet/gnome-pilot-pdialog.c
-capplet/gpilotd-capplet.glade
+capplet/gpilotd-capplet.ui
capplet/gpilotd-control-applet.c
capplet/gpilotd-control-applet.desktop.in.in
capplet/pilot.c
diff --git a/utils/gpilotd-client.c b/utils/gpilotd-client.c
index 99ec21b..af35d38 100644
--- a/utils/gpilotd-client.c
+++ b/utils/gpilotd-client.c
@@ -35,24 +35,24 @@ GList *outstanding_requests;
gboolean stay_alive = TRUE;
-static const struct poptOption options[] = {
- {"getinfo", '\0', POPT_ARG_NONE, &arg_getinfo, 0, N_("Get System Info"), NULL},
- {"pause", 'p', POPT_ARG_NONE, &arg_pause, 0, N_("Pause daemon"), NULL},
- {"unpause", 'u', POPT_ARG_NONE, &arg_unpause, 0, N_("Unpause daemon"), NULL},
- {"restart", 'r', POPT_ARG_NONE, &arg_restart, 0, N_("Restart daemon"), NULL},
- {"setuser", 'S', POPT_ARG_NONE, &arg_setuser, 0, N_("Set user id and name"), NULL},
- {"pilotid" , '\0', POPT_ARG_INT, &arg_id, 0, N_("ID for the PDA"), N_("ID")},
- {"install",'\0', POPT_ARG_STRING, &arg_install, 0 , N_("Install file"), N_("FILE")},
- {"restore", '\0', POPT_ARG_STRING, &arg_restore, 0, N_("Restore directory"), N_("DIRECTORY")},
- {"conduit", '\0', POPT_ARG_STRING, &arg_conduit, 0, N_("Run conduit"), N_("CONDUIT")},
- {"userid", '\0', POPT_ARG_STRING, &arg_username, 0, N_("Username to set"), N_("USERNAME")},
- {"monitor", 'm', POPT_ARG_NONE, &arg_monitor, 0, N_("Monitor the specified PDA's actions"), NULL},
- {"monitorall", 'A', POPT_ARG_NONE, &arg_monitorall, 0, N_("Monitor all PDAs"), NULL},
- {"listpilots", '\0', POPT_ARG_STRING, &arg_list_by_login, 0, N_("list PDAs by login (all for all pilots)"), N_("LOGIN")},
- {"pilot", '\0', POPT_ARG_STRING, &arg_pilot, 0, N_("Specify PDA to operate on (defaults to MyPDA)"), N_("PILOTNAME")},
- {"cradle", '\0', POPT_ARG_STRING, &arg_cradle, 0, N_("Specify a cradle to operate on (defaults to Cradle0)"), N_("CRADLENAME")},
- {"listbases", 'l', POPT_ARG_NONE, &arg_listbases, 0, N_("List the specified PDA's bases"), NULL},
- {NULL, '\0', 0, NULL, 0} /* end the list */
+static GOptionEntry options[] = {
+ {"getinfo", '\0', 0, G_OPTION_ARG_NONE, &arg_getinfo, N_("Get System Info"), NULL},
+ {"pause", 'p', 0, G_OPTION_ARG_NONE, &arg_pause, N_("Pause daemon"), NULL},
+ {"unpause", 'u', 0, G_OPTION_ARG_NONE, &arg_unpause, N_("Unpause daemon"), NULL},
+ {"restart", 'r', 0, G_OPTION_ARG_NONE, &arg_restart, N_("Restart daemon"), NULL},
+ {"setuser", 'S', 0, G_OPTION_ARG_NONE, &arg_setuser, N_("Set user id and name"), NULL},
+ {"pilotid" , '\0', 0, G_OPTION_ARG_INT, &arg_id, N_("ID for the PDA"), N_("ID")},
+ {"install",'\0', 0, G_OPTION_ARG_STRING, &arg_install, N_("Install file"), N_("FILE")},
+ {"restore", '\0', 0, G_OPTION_ARG_STRING, &arg_restore, N_("Restore directory"), N_("DIRECTORY")},
+ {"conduit", '\0', 0, G_OPTION_ARG_STRING, &arg_conduit, N_("Run conduit"), N_("CONDUIT")},
+ {"userid", '\0', 0, G_OPTION_ARG_STRING, &arg_username, N_("Username to set"), N_("USERNAME")},
+ {"monitor", 'm', 0, G_OPTION_ARG_NONE, &arg_monitor, N_("Monitor the specified PDA's actions"), NULL},
+ {"monitorall", 'A', 0, G_OPTION_ARG_NONE, &arg_monitorall, N_("Monitor all PDAs"), NULL},
+ {"listpilots", '\0', 0, G_OPTION_ARG_STRING, &arg_list_by_login, N_("list PDAs by login (all for all pilots)"), N_("LOGIN")},
+ {"pilot", '\0', 0, G_OPTION_ARG_STRING, &arg_pilot, N_("Specify PDA to operate on (defaults to MyPDA)"), N_("PILOTNAME")},
+ {"cradle", '\0', 0, G_OPTION_ARG_STRING, &arg_cradle, N_("Specify a cradle to operate on (defaults to Cradle0)"), N_("CRADLENAME")},
+ {"listbases", 'l', 0, G_OPTION_ARG_NONE, &arg_listbases, N_("List the specified PDA's bases"), NULL},
+ {NULL},
};
static void
@@ -342,8 +342,9 @@ get_system_info (void)
int
main (int argc, char *argv[]) {
- poptContext pctx;
-
+ GOptionContext *option_context;
+ GnomeProgram *program;
+
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
@@ -353,8 +354,17 @@ main (int argc, char *argv[]) {
exit (1);
}
- gnome_init_with_popt_table ("gpilotd-client","1.0",
- argc, argv, options, 0, &pctx);
+ option_context = g_option_context_new (PACKAGE);
+ g_option_context_add_main_entries (option_context, options, NULL);
+ program = gnome_program_init(PACKAGE, VERSION, LIBGNOMEUI_MODULE,
+ argc, argv,
+ GNOME_PARAM_GOPTION_CONTEXT, option_context,
+ GNOME_PARAM_NONE);
+
+ if (program == NULL) {
+ g_error (_("Error initializing gpilotd-client"));
+ exit (1);
+ }
g_message (_("\nBEWARE!!\nThis is a tool for certain parts of the gnome-pilot package.\nUnless you know what you're doing, don't use this tool."));
diff --git a/utils/gpilotdcm-client.c b/utils/gpilotdcm-client.c
index 0644e84..6eb70cd 100644
--- a/utils/gpilotdcm-client.c
+++ b/utils/gpilotdcm-client.c
@@ -23,18 +23,18 @@ int arg_listconduits,
guint32 arg_pilot;
gchar * arg_conduit;
-static const struct poptOption options[] = {
- {"listconduits", 'l', POPT_ARG_NONE, &arg_listconduits, 0, N_("lists available conduits"), NULL},
- {"conduit", '\0', POPT_ARG_STRING, &arg_conduit, 0, N_("conduit to operate on"), N_("CONDUIT")},
- {"listallattribs", 'A', POPT_ARG_NONE, &arg_allattrs, 0, N_("list all attributes"), NULL},
- {"pilotid", '\0', POPT_ARG_INT, &arg_pilot, 0, N_("specify PDA to operate on"), N_("PDA_ID")},
- {"listattribs",'a', POPT_ARG_NONE, &arg_attrs, 0, N_("list attributes"), NULL},
- {"listconduitswithstat",'s', POPT_ARG_NONE, &arg_listconduitsstate, 0, N_("list available conduits and their state"), NULL},
- {"enable",'e', POPT_ARG_NONE, &arg_enable, 0, N_("enable specified conduit"), NULL},
- {"disable",'d', POPT_ARG_NONE, &arg_disable, 0, N_("disable specified conduit"), NULL},
- {"enablefirstslow",'E', POPT_ARG_NONE, &arg_enableslow, 0, N_("enable, and set firstsync to slow"), NULL},
- {"instantiate",'i', POPT_ARG_NONE, &arg_instantiate, 0 , N_("instantiate and destroy the conduit"), NULL},
- {NULL, '\0', 0, NULL, 0} /* end the list */
+static GOptionEntry options[] = {
+ {"listconduits", 'l', 0, G_OPTION_ARG_NONE, &arg_listconduits, N_("lists available conduits"), NULL},
+ {"conduit", '\0', 0, G_OPTION_ARG_STRING, &arg_conduit, N_("conduit to operate on"), N_("CONDUIT")},
+ {"listallattribs", 'A', 0, G_OPTION_ARG_NONE, &arg_allattrs, N_("list all attributes"), NULL},
+ {"pilotid", '\0', 0, G_OPTION_ARG_INT, &arg_pilot, N_("specify PDA to operate on"), N_("PDA_ID")},
+ {"listattribs",'a', 0, G_OPTION_ARG_NONE, &arg_attrs, N_("list attributes"), NULL},
+ {"listconduitswithstat",'s', 0, G_OPTION_ARG_NONE, &arg_listconduitsstate, N_("list available conduits and their state"), NULL},
+ {"enable",'e', 0, G_OPTION_ARG_NONE, &arg_enable, N_("enable specified conduit"), NULL},
+ {"disable",'d', 0, G_OPTION_ARG_NONE, &arg_disable, N_("disable specified conduit"), NULL},
+ {"enablefirstslow",'E', 0, G_OPTION_ARG_NONE, &arg_enableslow, N_("enable, and set firstsync to slow"), NULL},
+ {"instantiate",'i', 0, G_OPTION_ARG_NONE, &arg_instantiate, N_("instantiate and destroy the conduit"), NULL},
+ {NULL} /* end the list */
};
static void
@@ -92,17 +92,28 @@ list_attribs (GnomePilotConduitManagement *c, gboolean filter) {
int
main (int argc, char *argv[]) {
- poptContext pctx;
GnomePilotConduitManagement *gpcm;
GnomePilotConduitConfig *gpcc;
GList *conduits = NULL,*it;
const gchar* const *ll;
+ GOptionContext *option_context;
+ GnomeProgram *program;
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- gnome_init_with_popt_table ("gpilotdcm-client","1.0", argc, argv, options,0,&pctx);
+ option_context = g_option_context_new (PACKAGE);
+ g_option_context_add_main_entries (option_context, options, NULL);
+ program = gnome_program_init(PACKAGE, VERSION, LIBGNOMEUI_MODULE,
+ argc, argv,
+ GNOME_PARAM_GOPTION_CONTEXT, option_context,
+ GNOME_PARAM_NONE);
+
+ if (program == NULL) {
+ g_error (_("Error initializing gpilotdcm-client"));
+ exit (1);
+ }
g_print (_("\nBEWARE!!\nThis is a tool for certain parts of the gnome-pilot package.\nUnless you know what you're doing, don't use this tool."));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]