#include <glib/gi18n.h>
#include <string.h>
#include <gtk/gtk.h>
-#include <gtk/gtktext.h>
#include <gdk/gdkkeysyms.h>
#include "utils.h"
GtkWidget *apply_btn;
gint *save_width;
gint *save_height;
+ PrefsCloseCallbackFunc open_cb;
+ PrefsCloseCallbackFunc close_cb;
GtkWidget *empty_page;
gpointer data;
GSList *prefs_pages;
- GtkDestroyNotify func;
+ GDestroyNotify func;
};
struct _PrefsTreeNode
}
}
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
static void prefs_show_sections(PrefsWindow *prefswindow)
{
gint max;
PrefsWindow *prefswindow = (PrefsWindow *) user_data;
save_all_pages(prefswindow->prefs_pages);
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
prefs_show_sections(prefswindow);
#endif
}
close_all_pages(prefswindow->prefs_pages);
+ if (prefswindow->close_cb)
+ prefswindow->close_cb(GTK_WINDOW(prefswindow->window));
+
gtk_widget_destroy(prefswindow->window);
g_slist_free(prefswindow->prefs_pages);
if(prefswindow->func != NULL)
{
PrefsWindow *prefswindow = (PrefsWindow *) user_data;
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
save_all_pages(prefswindow->prefs_pages);
#endif
close_prefs_window(prefswindow);
(GTK_TREE_VIEW(tree_view)));
GSList *cur;
gint index; /* index in pages list */
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
GtkTreeSelection *selection;
GtkTreeIter iter;
#endif
prefswindow_build_all_pages(prefswindow, prefs_pages);
/* select first one or its first child if necessary */
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) {
if (activate_child && gtk_tree_model_iter_has_child(GTK_TREE_MODEL(store), &iter)) {
}
void prefswindow_open_full(const gchar *title, GSList *prefs_pages,
- gpointer data, GtkDestroyNotify func,
+ gpointer data, GDestroyNotify func,
gint *save_width, gint *save_height,
- gboolean preload_pages, gboolean activate_child)
+ gboolean preload_pages, gboolean activate_child,
+ PrefsOpenCallbackFunc open_cb,
+ PrefsCloseCallbackFunc close_cb)
{
PrefsWindow *prefswindow;
gint x = gdk_screen_width();
prefswindow->prefs_pages = g_slist_copy(prefs_pages);
prefswindow->save_width = save_width;
prefswindow->save_height = save_height;
+ prefswindow->open_cb = open_cb;
+ prefswindow->close_cb = close_cb;
prefswindow->window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefswindow");
gtk_window_set_title(GTK_WINDOW(prefswindow->window), title);
prefswindow_build_tree(prefswindow->tree_view, prefs_pages, prefswindow,
preload_pages, activate_child);
+ if (open_cb)
+ open_cb(GTK_WINDOW(prefswindow->window));
+
gtk_widget_grab_focus(prefswindow->tree_view);
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
gtkut_stock_button_set_create(&prefswindow->confirm_area,
&prefswindow->apply_btn, GTK_STOCK_APPLY,
&prefswindow->cancel_btn, GTK_STOCK_CANCEL,
gtk_box_pack_start(GTK_BOX(prefswindow->vbox), prefswindow->confirm_area, FALSE, FALSE, 0);
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
g_signal_connect(G_OBJECT(prefswindow->ok_btn), "clicked",
G_CALLBACK(ok_button_clicked), prefswindow);
g_signal_connect(G_OBJECT(prefswindow->cancel_btn), "clicked",
*(prefswindow->save_height));
}
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
prefs_show_sections(prefswindow);
#endif
gtk_widget_show(prefswindow->window);
}
void prefswindow_open(const gchar *title, GSList *prefs_pages, gpointer data,
- gint *save_width, gint *save_height)
+ gint *save_width, gint *save_height,
+ PrefsOpenCallbackFunc open_cb,
+ PrefsCloseCallbackFunc close_cb)
{
prefswindow_open_full(title, prefs_pages, data, NULL, save_width, save_height,
- FALSE, FALSE);
+ FALSE, FALSE, open_cb, close_cb);
}
/*!
GtkTreeIter iter;
GtkAdjustment *adj;
-#ifndef MAEMO
+ if (gtk_tree_path_get_depth(path) < 2)
+ return FALSE;
+#ifndef GENERIC_UMPC
if (currently_selected)
return TRUE;
#endif
gtk_adjustment_set_value(adj, adj->lower);
gtk_adjustment_changed(adj);
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
prefs_show_page(prefswindow);
#endif
return TRUE;