[gok] Remove libgnome and libgnomeui dependency - bgo#589117
- From: Gerd Kohlberger <gerdk src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gok] Remove libgnome and libgnomeui dependency - bgo#589117
- Date: Mon, 10 Aug 2009 20:06:09 +0000 (UTC)
commit c10c6584449e644173fe738f99f3416bce6d17dc
Author: Gerd Kohlberger <gerdk src gnome org>
Date: Mon Aug 10 21:58:59 2009 +0200
Remove libgnome and libgnomeui dependency - bgo#589117
configure.in now checks for 2 additional packages:
gconf-2.0 >= 2.16.0 and dbus-glib-1 >= 0.7
configure.in | 28 ++++----
gok-1.0.pc.in | 2 +-
gok.glade2 | 133 +++++++++++++++++++-------------
gok/callbacks.c | 17 ----
gok/gok-key.c | 21 ++---
gok/gok-page-keyboard.c | 115 +++++++++++++++++++++-------
gok/gok-sliding-window-word-complete.c | 15 ++--
gok/gok-utf8-word-complete.c | 11 +--
gok/gok-word-complete.c | 8 +-
gok/main.c | 119 ++++++++++++++++++++--------
gok/test-gok-action.c | 7 +-
gok/test-gok-feedback.c | 7 +-
gok/test-gok-wordcomplete.c | 5 +-
gok/word-complete.c | 11 +--
14 files changed, 302 insertions(+), 197 deletions(-)
---
diff --git a/configure.in b/configure.in
index 3d52485..f2122bb 100644
--- a/configure.in
+++ b/configure.in
@@ -160,20 +160,20 @@ dnl ====================================
GTK_DOC_CHECK([1.0])
dnl Checks for libraries
-PKG_CHECK_MODULES(GOK, \
- glib-2.0 >= 2.17.4 \
- libgnome-2.0 >= 2.0.0 \
- libgnomeui-2.0 >= 2.0.0 \
- cspi-1.0 >= 1.5.0 \
- libspi-1.0 >= 1.5.0 \
- libloginhelper-1.0 >= 1.5.2 \
- libbonobo-2.0 >= 2.5.1 \
- atk >= 1.3.0 \
- gtk+-2.0 >= 2.14.0 \
- gail \
- libwnck-1.0 \
- gnome-speech-1.0 \
- libcanberra-gtk >= 0.3 \
+PKG_CHECK_MODULES(GOK,
+ glib-2.0 >= 2.17.4
+ cspi-1.0 >= 1.5.0
+ libspi-1.0 >= 1.5.0
+ libloginhelper-1.0 >= 1.5.2
+ libbonobo-2.0 >= 2.5.1
+ atk >= 1.3.0
+ gtk+-2.0 >= 2.14.0
+ gail
+ libwnck-1.0
+ gnome-speech-1.0
+ libcanberra-gtk >= 0.3
+ dbus-glib-1 >= 0.7
+ gconf-2.0 >= 2.16.0
libglade-2.0)
AC_SUBST(GOK_LIBS)
AC_SUBST(GOK_CFLAGS)
diff --git a/gok-1.0.pc.in b/gok-1.0.pc.in
index 9887225..af7a4da 100644
--- a/gok-1.0.pc.in
+++ b/gok-1.0.pc.in
@@ -3,7 +3,7 @@ exec_prefix= exec_prefix@
Name: Gok
Description: GNOME On-screen Keyboard
-Requires: libgnomeui-2.0 cspi-1.0 libspi-1.0 libbonobo-2.0 atk gtk+-2.0 gail libwnck-1.0
+Requires: cspi-1.0 libspi-1.0 libbonobo-2.0 atk gtk+-2.0 gail libwnck-1.0
Version: @VERSION@
Libs:
Cflags:
diff --git a/gok.glade2 b/gok.glade2
index 802a458..403a3d0 100644
--- a/gok.glade2
+++ b/gok.glade2
@@ -72,7 +72,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">60 5 200 1 10 10</property>
+ <property name="adjustment">60 5 200 1 10 0</property>
<accessibility>
<atkrelation target="label9" type="labelled-by"/>
</accessibility>
@@ -99,7 +99,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">30 5 100 1 10 10</property>
+ <property name="adjustment">30 5 100 1 10 0</property>
<accessibility>
<atkrelation target="label10" type="labelled-by"/>
</accessibility>
@@ -303,7 +303,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 50 1 10 10</property>
+ <property name="adjustment">0 0 50 1 10 0</property>
<signal name="changed" handler="on_spinSpacing_changed" last_modification_time="Wed, 02 Oct 2002 13:47:46 GMT"/>
</widget>
<packing>
@@ -352,7 +352,7 @@
<widget class="GtkFrame" id="frame2">
<property name="border_width">4</property>
<property name="visible">True</property>
- <property name="label_xalign">0.0</property>
+ <property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
@@ -783,32 +783,40 @@
<property name="spacing">0</property>
<child>
- <placeholder/>
+ <widget class="GtkLabel" id="spacer1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">10</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
<child>
- <widget class="GnomeFileEntry" id="XmlKeyboardGnomeFileEntry">
+ <widget class="GtkFileChooserButton" id="XmlKeyboardFileChooser">
<property name="visible">True</property>
- <property name="max_saved">10</property>
- <property name="directory_entry">False</property>
- <property name="modal">False</property>
- <property name="use_filechooser">False</property>
- <property name="filechooser_action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
-
- <child internal-child="entry">
- <widget class="GtkEntry" id="XMLKeyboardFileEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- <signal name="changed" handler="on_compose_keyboard_file_entry_changed" last_modification_time="Thu, 22 Apr 2004 21:07:30 GMT"/>
- </widget>
- </child>
+ <property name="title">Select A File</property>
+ <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+ <property name="local_only">True</property>
+ <property name="show_hidden">False</property>
+ <property name="do_overwrite_confirmation">False</property>
+ <property name="width_chars">-1</property>
+ <signal name="file_set" handler="on_compose_keyboard_file_set" last_modification_time="Tue, 04 Aug 2009 13:24:41 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
@@ -851,7 +859,7 @@
</widget>
<packing>
<property name="padding">12</property>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
@@ -868,7 +876,7 @@
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="spacing">4</property>
<child>
<widget class="GtkLabel" id="label128">
@@ -881,7 +889,7 @@
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
- <property name="xpad">12</property>
+ <property name="xpad">2</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
@@ -896,19 +904,13 @@
</child>
<child>
- <widget class="GnomeFileEntry" id="AuxKeyboardDirEntry">
- <property name="border_width">12</property>
+ <widget class="GtkHBox" id="hbox103">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="max_saved">5</property>
- <property name="browse_dialog_title" translatable="yes">Additional directory to search for GOK keyboard files</property>
- <property name="directory_entry">True</property>
- <property name="modal">False</property>
- <property name="use_filechooser">False</property>
- <property name="filechooser_action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">4</property>
- <child internal-child="entry">
- <widget class="GtkEntry" id="AuxKeyboardEntry">
+ <child>
+ <widget class="GtkEntry" id="AuxKeyboardDirEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -916,10 +918,31 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
- <property name="invisible_char">*</property>
+ <property name="invisible_char">â?¢</property>
<property name="activates_default">False</property>
- <signal name="changed" handler="on_aux_keyboard_dir_entry_changed" last_modification_time="Fri, 23 Apr 2004 17:43:34 GMT"/>
</widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="AuxKeyboardDirButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Browse...</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <signal name="clicked" handler="on_aux_keyboard_dir_button_clicked" last_modification_time="Tue, 04 Aug 2009 14:06:44 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
</widget>
<packing>
@@ -1401,8 +1424,8 @@
<property name="single_line_mode">False</property>
<property name="angle">0</property>
<accessibility>
- <atkrelation target="radiobuttonTypeSwitch" type="label-for"/>
<atkrelation target="radiobuttonTypeValuator" type="label-for"/>
+ <atkrelation target="radiobuttonTypeSwitch" type="label-for"/>
</accessibility>
</widget>
<packing>
@@ -1780,7 +1803,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 3000 10 100 100</property>
+ <property name="adjustment">0 0 3000 10 100 0</property>
<accessibility>
<atkproperty name="AtkObject::accessible_name" translatable="yes">Delay</atkproperty>
<atkproperty name="AtkObject::accessible_description" translatable="yes">Delay, in 100ths of a second, after the triggering event occurs, before activation takes place.</atkproperty>
@@ -1973,7 +1996,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 1 10 0</property>
<signal name="changed" handler="on_axis_selection_spinbutton_changed" last_modification_time="Mon, 17 Feb 2003 22:48:08 GMT"/>
</widget>
<packing>
@@ -2054,7 +2077,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">1 0 100 1 10 0</property>
<signal name="changed" handler="on_pointer_delay_spinbutton_changed" last_modification_time="Mon, 17 Feb 2003 22:53:02 GMT"/>
</widget>
<packing>
@@ -2988,8 +3011,8 @@
<property name="single_line_mode">False</property>
<property name="angle">0</property>
<accessibility>
- <atkrelation target="comboFeedback" type="label-for"/>
<atkrelation target="label100" type="labelled-by"/>
+ <atkrelation target="comboFeedback" type="label-for"/>
</accessibility>
</widget>
<packing>
@@ -3093,7 +3116,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">4 1 15 1 3 3</property>
+ <property name="adjustment">4 1 15 1 3 0</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -3703,7 +3726,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">5 2 12 1 3 3</property>
+ <property name="adjustment">5 2 12 1 3 0</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -3930,7 +3953,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">5 2 12 1 3 3</property>
+ <property name="adjustment">5 2 12 1 3 0</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -5143,7 +5166,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 1 10 0</property>
<signal name="insert_text" handler="on_spinLeft_insert_text" last_modification_time="Mon, 07 Oct 2002 19:30:22 GMT"/>
</widget>
<packing>
@@ -5201,7 +5224,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 1 10 0</property>
<signal name="insert_text" handler="on_spinRight_insert_text" last_modification_time="Mon, 07 Oct 2002 19:32:34 GMT"/>
</widget>
<packing>
@@ -5259,7 +5282,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 1 10 0</property>
<signal name="insert_text" handler="on_spinTop_insert_text" last_modification_time="Mon, 07 Oct 2002 19:32:52 GMT"/>
</widget>
<packing>
@@ -5317,7 +5340,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 1 10 0</property>
<signal name="insert_text" handler="on_spinBottom_insert_text" last_modification_time="Mon, 07 Oct 2002 19:33:05 GMT"/>
</widget>
<packing>
@@ -6765,7 +6788,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">1 0 100 1 10 0</property>
</widget>
<packing>
<property name="padding">0</property>
diff --git a/gok/callbacks.c b/gok/callbacks.c
index fe16537..34a1fe3 100644
--- a/gok/callbacks.c
+++ b/gok/callbacks.c
@@ -936,14 +936,6 @@ on_dock_bottom_radiobutton_toggled (GtkToggleButton *button,
}
void
-on_aux_keyboard_dir_entry_changed (GtkEntry *entry,
- gpointer user_data)
-{
- gok_data_set_aux_keyboard_directory (gtk_entry_get_text (entry));
-}
-
-
-void
on_xkb_compose_keyboard_radiobutton_toggled (GtkToggleButton *button,
gpointer user_data)
{
@@ -976,14 +968,6 @@ on_file_compose_keyboard_radiobutton_toggled (GtkToggleButton *button,
}
void
-on_compose_keyboard_file_entry_changed (GtkEditable *editable,
- gpointer user_data)
-{
- gok_data_set_custom_compose_filename (
- gtk_editable_get_chars (editable, 0, -1));
-}
-
-void
on_core_pointer_button_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
@@ -991,7 +975,6 @@ on_core_pointer_button_toggled (GtkToggleButton *togglebutton,
gtk_toggle_button_get_active (togglebutton));
}
-
void
on_xinput_device_button_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
diff --git a/gok/gok-key.c b/gok/gok-key.c
index 32ab9b9..3d25fbf 100644
--- a/gok/gok-key.c
+++ b/gok/gok-key.c
@@ -24,7 +24,6 @@
#endif
#include <string.h>
-#include <libgnome/gnome-program.h>
#include <glib.h>
#include <glib/gi18n.h>
#include "gok-key.h"
@@ -1525,18 +1524,12 @@ gok_key_status_image (GokKey *key)
#else
icon_name = "small-empty.png";
#endif
- file = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_DATADIR,
- icon_name,
- FALSE, NULL);
-
- if (file) {
- image = gtk_image_new_from_file (file);
- g_free (file);
- }
+ file = g_strdup_printf (DATADIR "/gok/%s", icon_name);
+ image = gtk_image_new_from_file (file);
+ g_free (file);
return image;
}
-
/**
* gok_key_create_image_widget
@@ -2433,9 +2426,11 @@ gok_key_get_image_filename (GokKey* pKey)
gchar *filename = NULL;
g_assert (pKey != NULL);
- filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_DATADIR,
- pKey->pImage->Filename,
- FALSE, NULL);
+ if (pKey->pImage && pKey->pImage->Filename)
+ {
+ filename = g_strdup_printf (DATADIR "/gok/%s",
+ pKey->pImage->Filename);
+ }
return filename;
}
diff --git a/gok/gok-page-keyboard.c b/gok/gok-page-keyboard.c
index 9c07cab..ba1c6de 100644
--- a/gok/gok-page-keyboard.c
+++ b/gok/gok-page-keyboard.c
@@ -22,7 +22,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <libgnomeui/libgnomeui.h>
+
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <glib.h>
@@ -38,8 +38,8 @@ static gchar *save_compose_filename = NULL;
static gchar *save_aux_kbd_dirname;
/* privates */
-void gok_page_keyboard_initialize_compose_filename_entry (const char* file);
-void gok_page_keyboard_initialize_aux_keyboard_dir_entry (const char* file);
+static void gok_page_keyboard_initialize_compose_filename (const char* file);
+static void gok_page_keyboard_initialize_aux_keyboard_dir (const char* file);
/**
* gok_page_keyboard_initialize
@@ -76,12 +76,9 @@ gboolean gok_page_keyboard_initialize (GladeXML* xml)
g_assert (widget != NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), save_compose_type == GOK_COMPOSE_CUSTOM);
-
- gok_page_keyboard_initialize_compose_filename_entry ((save_compose_type == GOK_COMPOSE_CUSTOM) ?
- gok_data_get_custom_compose_filename () : "");
-
-
- gok_page_keyboard_initialize_aux_keyboard_dir_entry (gok_data_get_aux_keyboard_directory ());
+ gok_page_keyboard_initialize_compose_filename ((save_compose_type == GOK_COMPOSE_CUSTOM) ?
+ gok_data_get_custom_compose_filename () : "");
+ gok_page_keyboard_initialize_aux_keyboard_dir (gok_data_get_aux_keyboard_directory ());
return TRUE;
}
@@ -148,7 +145,7 @@ gok_page_keyboard_update_custom_dir_from_control ()
gok_log_enter();
pWidget = glade_xml_get_widget (gok_settingsdialog_get_xml(), "AuxKeyboardDirEntry");
g_assert (pWidget != NULL);
- text = gnome_file_entry_get_full_path ( (GnomeFileEntry*)pWidget, FALSE);
+ text = g_strdup (gtk_entry_get_text (GTK_ENTRY (pWidget)));
g_free (save_aux_kbd_dirname);
save_aux_kbd_dirname = text;
@@ -162,42 +159,104 @@ gok_page_keyboard_update_custom_compose_from_control ()
gchar* text;
gok_log_enter();
- pWidget = glade_xml_get_widget (gok_settingsdialog_get_xml(), "XmlKeyboardGnomeFileEntry");
+ pWidget = glade_xml_get_widget (gok_settingsdialog_get_xml(), "XmlKeyboardFileChooser");
g_assert (pWidget != NULL);
- text = gnome_file_entry_get_full_path ( (GnomeFileEntry*)pWidget, FALSE);
+ text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (pWidget));
g_free (save_compose_filename);
save_compose_filename = text;
-
gok_log_leave();
}
-void
-gok_page_keyboard_initialize_aux_keyboard_dir_entry (const char* file)
+static void
+gok_page_keyboard_initialize_aux_keyboard_dir (const char* file)
{
GtkWidget* pWidget;
gok_log_enter();
- pWidget = glade_xml_get_widget (gok_settingsdialog_get_xml(), "AuxKeyboardDirEntry");
- g_assert (pWidget != NULL);
- gnome_file_entry_set_modal ((GnomeFileEntry*)pWidget, FALSE);
- gnome_file_entry_set_title ((GnomeFileEntry*)pWidget, _("Enter directory to search for additional GOK keyboard files."));
- gnome_file_entry_set_directory_entry ((GnomeFileEntry*)pWidget, TRUE);
- gnome_file_entry_set_filename ( (GnomeFileEntry*)pWidget, file);
+ if (file)
+ {
+ pWidget = glade_xml_get_widget (gok_settingsdialog_get_xml (),
+ "AuxKeyboardDirEntry");
+ g_assert (pWidget != NULL);
+ gtk_entry_set_text (GTK_ENTRY (pWidget), file);
+ }
gok_log_leave();
}
-void
-gok_page_keyboard_initialize_compose_filename_entry (const char* file)
+
+void
+on_aux_keyboard_dir_dialog_response (GtkDialog *dialog, gint response, gpointer data)
+{
+ gchar *folder;
+
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
+ folder = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ if (folder)
+ {
+ GtkWidget *entry;
+
+ entry = glade_xml_get_widget (gok_settingsdialog_get_xml (),
+ "AuxKeyboardDirEntry");
+ gtk_entry_set_text (GTK_ENTRY (entry), folder);
+ gok_data_set_aux_keyboard_directory (folder);
+ g_free (folder);
+ }
+ }
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+void
+on_aux_keyboard_dir_button_clicked (GtkButton *button, gpointer data)
+{
+ GtkWidget *dialog, *entry;
+ gchar *folder;
+
+ dialog = gtk_file_chooser_dialog_new (
+ _("Enter directory to search for additional GOK keyboard files."),
+ NULL,
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_window_set_type_hint (GTK_WINDOW (dialog),
+ GDK_WINDOW_TYPE_HINT_NORMAL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog),
+ GTK_RESPONSE_ACCEPT);
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+ GTK_RESPONSE_ACCEPT,
+ GTK_RESPONSE_CANCEL,
+ -1);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (on_aux_keyboard_dir_dialog_response),
+ NULL);
+
+ entry = glade_xml_get_widget (gok_settingsdialog_get_xml (),
+ "AuxKeyboardDirEntry");
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog),
+ gtk_entry_get_text (GTK_ENTRY (entry)));
+ gtk_widget_show (dialog);
+}
+
+static void
+gok_page_keyboard_initialize_compose_filename (const char* file)
{
GtkWidget* pWidget;
gok_log_enter();
- pWidget = glade_xml_get_widget (gok_settingsdialog_get_xml(), "XmlKeyboardGnomeFileEntry");
+ pWidget = glade_xml_get_widget (gok_settingsdialog_get_xml(), "XmlKeyboardFileChooser");
g_assert (pWidget != NULL);
- gnome_file_entry_set_modal ((GnomeFileEntry*)pWidget, FALSE);
- gnome_file_entry_set_title ((GnomeFileEntry*)pWidget, _("Select the XML file defining your startup compose keyboard"));
- gnome_file_entry_set_directory_entry ((GnomeFileEntry*)pWidget, FALSE);
- gnome_file_entry_set_filename ( (GnomeFileEntry*)pWidget, file);
+ gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (pWidget),
+ _("Select the XML file defining your startup compose keyboard"));
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (pWidget), file);
gok_log_leave();
}
+void
+on_compose_keyboard_file_set (GtkFileChooserButton *button, gpointer data)
+{
+ gchar *file;
+ file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (button));
+ gok_data_set_custom_compose_filename (file ? file : "");
+ g_free (file);
+}
diff --git a/gok/gok-sliding-window-word-complete.c b/gok/gok-sliding-window-word-complete.c
index 549101f..d84b80e 100644
--- a/gok/gok-sliding-window-word-complete.c
+++ b/gok/gok-sliding-window-word-complete.c
@@ -20,7 +20,7 @@
*/
#include <string.h>
-#include <libgnome/gnome-macros.h>
+
#include "gok-log.h"
#include "gok-sliding-window-word-complete.h"
@@ -32,13 +32,12 @@ static const gchar* sw_wordcomplete_get_delimiter (GokWordComplete *complete);
/*
* This macro initializes GokUtf8WordComplete with the GType system
- * and defines ..._class_init and ..._instance_init functions
+ * and defines ..._class_init and ..._init functions and a ..._parent_class pointer.
*/
-GNOME_CLASS_BOILERPLATE (GokSWWordComplete, gok_sw_wordcomplete,
- GokUTF8WordComplete, GOK_TYPE_UTF8WORDCOMPLETE)
+G_DEFINE_TYPE (GokSWWordComplete, gok_sw_wordcomplete, GOK_TYPE_UTF8WORDCOMPLETE)
static void
-gok_sw_wordcomplete_instance_init (GokSWWordComplete *complete)
+gok_sw_wordcomplete_init (GokSWWordComplete *complete)
{
g_message ("created a sliding window word completion engine.\n");
}
@@ -46,9 +45,7 @@ gok_sw_wordcomplete_instance_init (GokSWWordComplete *complete)
static void
gok_sw_wordcomplete_class_init (GokSWWordCompleteClass *klass)
{
- GokWordCompleteClass *word_complete_class = (GokWordCompleteClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
+ GokWordCompleteClass *word_complete_class = GOK_WORDCOMPLETE_CLASS (klass);
word_complete_class->get_delimiter = sw_wordcomplete_get_delimiter;
word_complete_class->predict_string = sw_wordcomplete_predict_string;
@@ -62,7 +59,7 @@ static gchar** sw_wordcomplete_predict_string (GokWordComplete *complete, const
cp = g_utf8_offset_to_pointer (pWord, len - 1);
else
cp = pWord;
- return GOK_WORDCOMPLETE_CLASS (parent_class)->predict_string (complete, cp, num_predictions);
+ return GOK_WORDCOMPLETE_CLASS (gok_sw_wordcomplete_parent_class)->predict_string (complete, cp, num_predictions);
}
static const gchar* sw_wordcomplete_get_delimiter (GokWordComplete *complete)
diff --git a/gok/gok-utf8-word-complete.c b/gok/gok-utf8-word-complete.c
index 46652b4..3a0ceaf 100644
--- a/gok/gok-utf8-word-complete.c
+++ b/gok/gok-utf8-word-complete.c
@@ -22,7 +22,7 @@
#include <string.h>
#include <glib.h>
#include <glib/gi18n.h>
-#include <libgnome/gnome-macros.h>
+
#include "gok-log.h"
#include "gok-utf8-word-complete.h"
@@ -75,13 +75,12 @@ static void utf8_word_prediction_free (WordPrediction *prediction);
/*
* This macro initializes GokUtf8WordComplete with the GType system
- * and defines ..._class_init and ..._instance_init functions
+ * and defines ..._class_init and ..._init functions and a ..._parent_class pointer
*/
-GNOME_CLASS_BOILERPLATE (GokUTF8WordComplete, gok_utf8_wordcomplete,
- GokWordComplete, GOK_TYPE_WORDCOMPLETE)
+G_DEFINE_TYPE (GokUTF8WordComplete, gok_utf8_wordcomplete, GOK_TYPE_WORDCOMPLETE)
static void
-gok_utf8_wordcomplete_instance_init (GokUTF8WordComplete *complete)
+gok_utf8_wordcomplete_init (GokUTF8WordComplete *complete)
{
complete->word_list = NULL;
complete->word_list_end = NULL;
@@ -93,7 +92,7 @@ gok_utf8_wordcomplete_instance_init (GokUTF8WordComplete *complete)
static void
gok_utf8_wordcomplete_class_init (GokUTF8WordCompleteClass *klass)
{
- GokWordCompleteClass *word_complete_class = (GokWordCompleteClass *) klass;
+ GokWordCompleteClass *word_complete_class = GOK_WORDCOMPLETE_CLASS (klass);
word_complete_class->open = utf8_wordcomplete_open;
word_complete_class->close = utf8_wordcomplete_close;
word_complete_class->predict_string = utf8_wordcomplete_predict_string;
diff --git a/gok/gok-word-complete.c b/gok/gok-word-complete.c
index bae3d44..6803980 100644
--- a/gok/gok-word-complete.c
+++ b/gok/gok-word-complete.c
@@ -33,7 +33,6 @@
#endif
#include <locale.h>
-#include <libgnome/gnome-macros.h>
#include "gok-word-complete.h"
#include "gok-keyslotter.h"
@@ -72,11 +71,10 @@ struct _GokWordCompletePrivate
static GokWordComplete *default_wordcomplete_engine = NULL;
-GNOME_CLASS_BOILERPLATE (GokWordComplete, gok_wordcomplete,
- GObject, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GokWordComplete, gok_wordcomplete, G_TYPE_OBJECT)
static void
-gok_wordcomplete_instance_init (GokWordComplete *complete)
+gok_wordcomplete_init (GokWordComplete *complete)
{
complete->priv = g_new0 (GokWordCompletePrivate, 1);
complete->priv->word_part = NULL;
@@ -118,7 +116,7 @@ gok_wordcomplete_finalize (GObject *obj)
if (complete && complete->priv)
g_free (complete->priv);
- G_OBJECT_CLASS (GOK_WORDCOMPLETE_GET_CLASS (obj))->finalize (obj);
+ G_OBJECT_CLASS (gok_wordcomplete_parent_class)->finalize (obj);
}
/**
diff --git a/gok/main.c b/gok/main.c
index 4f31c61..bcfef30 100644
--- a/gok/main.c
+++ b/gok/main.c
@@ -30,11 +30,11 @@
#include <sys/types.h>
#include <dirent.h>
#include <signal.h>
-#include <libgnome/gnome-program.h>
-#include <libgnomeui/gnome-client.h>
-#include <libgnomeui/libgnomeui.h>
+#include <unistd.h>
+#include <errno.h>
#include <glib/gstdio.h>
#include <glib/gi18n.h>
+#include <dbus/dbus-glib.h>
#include <cspi/spi.h>
#include <libbonobo.h>
#include <bonobo-activation/bonobo-activation.h>
@@ -104,6 +104,13 @@ static Display *xevie_dpy = NULL;
#define GCONF_ACCESSIBILITY_KEY "/desktop/gnome/interface/accessibility"
#define KEYBOARD_ACCESSIBILITY_ENABLE_KEY "/desktop/gnome/accessibility/keyboard/enable"
+/* GNOME Session Manager */
+#define GSM_SERVICE_DBUS "org.gnome.SessionManager"
+#define GSM_PATH_DBUS "/org/gnome/SessionManager"
+#define GSM_INTERFACE_DBUS "org.gnome.SessionManager"
+
+#define GSM_LOGOUT_MODE_NORMAL 0
+
static gboolean respawn_on_segv = TRUE;
static guint input_idle_handler = 0;
@@ -433,7 +440,7 @@ gok_args_init (GokArgs *args)
args->custom_compose_kbd_name = NULL;
args->display_keyboard_editor = FALSE;
args->geometry = NULL;
- args->geometry_bitmask;
+ args->geometry_bitmask = 0;
args->is_login = 0;
args->debug_nameless = FALSE;
args->remember_geometry = FALSE;
@@ -643,9 +650,9 @@ gok_main_center_corepointer (GtkWidget *window)
gint
gok_main_open(gint argc, gchar *argv[])
{
- GnomeProgram *gok_program;
GOptionContext *context;
- gboolean create_dirs;
+ GError *error = NULL;
+ gboolean create_dirs, parsed;
int i;
/* initialize member data */
@@ -658,23 +665,22 @@ gok_main_open(gint argc, gchar *argv[])
gok_args_init (&gok_args);
- context = g_option_context_new (_("The GNOME On-screen Keyboard"));
+ context = g_option_context_new (_("The GNOME On-screen Keyboard"));
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
+ parsed = g_option_context_parse (context, &argc, &argv, &error);
+ g_option_context_free (context);
+ if (!parsed)
+ {
+ g_print ("%s\n", error->message);
+ g_error_free (error);
+ _exit (-1);
+ }
/* If the user does not have a writable HOME directory, then
avoid creating the directory. */
create_dirs = (g_access (g_get_home_dir(), W_OK) == 0);
- /* Initialize Gnome */
- gok_program = gnome_program_init (PACKAGE, VERSION,
- LIBGNOMEUI_MODULE, argc, argv,
- GNOME_PARAM_GOPTION_CONTEXT, context,
- GNOME_PROGRAM_STANDARD_PROPERTIES,
- GNOME_PARAM_APP_DATADIR, DATADIR"/gok",
- LIBGNOMEUI_PARAM_CRASH_DIALOG, FALSE,
- GNOME_PARAM_CREATE_DIRECTORIES, create_dirs,
- NULL);
-
if (!bonobo_init (&argc, argv))
{
if (gok_args.is_login)
@@ -1012,8 +1018,6 @@ gok_log ("finished check");
signal(SIGTERM, (void (*)(int))gok_sig_handler);
signal(SIGINT, (void (*)(int))gok_sig_handler);
- g_object_unref (gok_program);
-
return 0;
}
@@ -3168,24 +3172,72 @@ static GtkWidget* _corepointer_warning = NULL; /* core pointer warning dialog */
static gboolean _corepointer_warning_posted = FALSE; /* core pointer warning dialog has been posted */
-void check_accessibility_cb ( GObject* o, gpointer* data )
+/**
+ * gok_main_request_logout:
+ *
+ * Calls the 'Logout' method of gnome-session-manager over DBus.
+ * The 'mode' argument is set to 0 (normal).
+ * Other modes are 1 (no confirmation) and 2 (force).
+ *
+ * Returns: #TRUE on success, #FALSE otherwise.
+ */
+static gboolean
+gok_main_request_logout (void)
{
- GnomeClient *client;
+ DBusGConnection *bus;
+ DBusGProxy *sm_proxy;
+ GError *error = NULL;
+ gboolean ret = FALSE;
+
+ gok_log_enter ();
+
+ /* get session bus */
+ bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
+ if (bus)
+ {
+ /* create g-s-m proxy */
+ sm_proxy = dbus_g_proxy_new_for_name (bus,
+ GSM_SERVICE_DBUS,
+ GSM_PATH_DBUS,
+ GSM_INTERFACE_DBUS);
+ /* request logout (sync. call) */
+ ret = dbus_g_proxy_call (sm_proxy, "Logout", &error,
+ G_TYPE_UINT, GSM_LOGOUT_MODE_NORMAL,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ g_object_unref (sm_proxy);
+ if (error)
+ {
+ gok_log ("Logout method: %s", error->message);
+ g_error_free (error);
+ }
+ }
+ else
+ {
+ gok_log ("Couldn't connect to session bus.");
+ }
+ gok_log_leave ();
+
+ return ret;
+}
+
+static void
+check_accessibility_cb (GtkButton *button, gpointer data)
+{
+ if (acd) {
+ gtk_widget_destroy(acd);
+ acd = NULL;
+ }
- if (acd) {
- gtk_widget_destroy(acd); acd = NULL;
- }
-
if (strcmp((gchar*)data,"logout") == 0) {
- gok_gconf_set_bool ( gok_data_get_gconf_client(),
- GCONF_ACCESSIBILITY_KEY, TRUE );
- if (!(client = gnome_master_client())) {
- gok_main_close();
+ /* enable gnome a11y key */
+ gok_gconf_set_bool (gok_data_get_gconf_client (),
+ GCONF_ACCESSIBILITY_KEY, TRUE);
+
+ /* request logout */
+ if (!gok_main_request_logout ()) {
+ /* exit if logout fails */
+ gok_main_close ();
}
- gnome_client_request_save (client, GNOME_SAVE_GLOBAL, TRUE,
- GNOME_INTERACT_ANY, FALSE, TRUE); /* code borrowed from
- gnome-control-center/ capplets/ accessibility/ at-properties/
- main.c */
}
else if (strcmp((gchar*)data,"quit") == 0) {
gok_main_close();
@@ -3194,7 +3246,6 @@ void check_accessibility_cb ( GObject* o, gpointer* data )
else if (strcmp((gchar*)data,"continue") == 0) {
/* maybe change gok somehow to show user weakened status */
}
-
}
/**
diff --git a/gok/test-gok-action.c b/gok/test-gok-action.c
index fb8bf64..7957a2b 100644
--- a/gok/test-gok-action.c
+++ b/gok/test-gok-action.c
@@ -24,8 +24,7 @@
# include <config.h>
#endif
-#include <glib.h>
-#include <libgnomeui/libgnomeui.h>
+#include <gtk/gtk.h>
#include "gok-action.h"
#include "gok-log.h"
@@ -49,7 +48,7 @@ void test_unsetting_in_gconf ();
gint main (gint argc, gchar* argv[])
{
- gnome_init ("test-gok-action", "0.1", argc, argv);
+ gtk_init (&argc, &argv);
test_gok_action_get_key ();
/* remove until bug 129391 is resolved
@@ -73,7 +72,7 @@ gint main (gint argc, gchar* argv[])
test_unsetting_in_gconf ();
*/
- exit (0);
+ return 0;
}
void setup ()
diff --git a/gok/test-gok-feedback.c b/gok/test-gok-feedback.c
index 84a01bf..fd7025b 100644
--- a/gok/test-gok-feedback.c
+++ b/gok/test-gok-feedback.c
@@ -24,7 +24,7 @@
# include <config.h>
#endif
-#include <libgnomeui/libgnomeui.h>
+#include <gtk/gtk.h>
#include "gok-feedback.h"
#include "gok-log.h"
@@ -44,7 +44,8 @@ void test_unsetting_in_gconf ();
gint main (gint argc, gchar* argv[])
{
- gnome_init ("test-gok-feedback", "0.1", argc, argv);
+ gtk_init (&argc, &argv);
+
test_gok_feedback_get_key ();
/* remove until bug 129391 is resolved
test_add ();
@@ -56,7 +57,7 @@ gint main (gint argc, gchar* argv[])
test_storage_and_retrieval ();
test_unsetting_in_gconf ();
*/
- exit (0);
+ return 0;
}
gboolean gok_main_safe_mode ()
diff --git a/gok/test-gok-wordcomplete.c b/gok/test-gok-wordcomplete.c
index 87a3044..a1ed33b 100644
--- a/gok/test-gok-wordcomplete.c
+++ b/gok/test-gok-wordcomplete.c
@@ -20,7 +20,8 @@
* Boston, MA 02111-1307, USA.
*/
-#include <libgnomeui/libgnomeui.h>
+#include <string.h>
+#include <gtk/gtk.h>
#include "gok-word-complete.h"
#define PREDICTIONS_PER_INVOCATION 5
@@ -36,7 +37,7 @@ gint main (gint argc, gchar* argv[])
gdouble sec;
gulong usec;
- gnome_init ("test-gok-wordcomplete", "0.1", argc, argv);
+ gtk_init (&argc, &argv);
complete = gok_wordcomplete_get_default ();
gok_wordcomplete_set_aux_dictionaries (complete, "/usr/share/dict/words");
diff --git a/gok/word-complete.c b/gok/word-complete.c
index e90c740..5fd7853 100644
--- a/gok/word-complete.c
+++ b/gok/word-complete.c
@@ -29,7 +29,7 @@
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
-#include <libgnome/gnome-macros.h>
+
#include "word-complete.h"
#include "gok-log.h"
@@ -85,20 +85,19 @@ static gchar *dictionary_full_path;
/*
* This macro initializes GokTrieWordComplete with the GType system
- * and defines ..._class_init and ..._instance_init functions
+ * and defines ..._class_init and ..._init functions and a ..._parent_class pointer
*/
-GNOME_CLASS_BOILERPLATE (GokTrieWordComplete, gok_trie_wordcomplete,
- GokWordComplete, GOK_TYPE_WORDCOMPLETE)
+G_DEFINE_TYPE (GokTrieWordComplete, gok_trie_wordcomplete, GOK_TYPE_WORDCOMPLETE)
static void
-gok_trie_wordcomplete_instance_init (GokTrieWordComplete *complete)
+gok_trie_wordcomplete_init (GokTrieWordComplete *complete)
{
}
static void
gok_trie_wordcomplete_class_init (GokTrieWordCompleteClass *klass)
{
- GokWordCompleteClass *word_complete_class = (GokWordCompleteClass *) klass;
+ GokWordCompleteClass *word_complete_class = GOK_WORDCOMPLETE_CLASS (klass);
word_complete_class->open = WordCompleteOpen;
word_complete_class->close = WordCompleteClose;
word_complete_class->increment_word_frequency = WordCompleteIncrementFrequency;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]