/** * gva_main_init: * * Initializes the main window. * * This function should be called once when the application starts. **/ void gva_main_init (void) { gchar *text; gva_tree_view_init (); gtk_box_pack_start ( GTK_BOX (GVA_WIDGET_MAIN_VBOX), gva_ui_get_managed_widget ("/main-menu"), FALSE, FALSE, 0); gtk_action_connect_proxy ( GVA_ACTION_VIEW_AVAILABLE, GVA_WIDGET_MAIN_VIEW_BUTTON_0); gtk_action_connect_proxy ( GVA_ACTION_VIEW_FAVORITES, GVA_WIDGET_MAIN_VIEW_BUTTON_1); gtk_action_connect_proxy ( GVA_ACTION_VIEW_RESULTS, GVA_WIDGET_MAIN_VIEW_BUTTON_2); gtk_action_connect_proxy ( GVA_ACTION_PROPERTIES, GVA_WIDGET_MAIN_PROPERTIES_BUTTON); gtk_action_connect_proxy ( GVA_ACTION_START, GVA_WIDGET_MAIN_START_GAME_BUTTON); gtk_widget_set_sensitive ( GVA_WIDGET_MAIN_MUTE_BUTTON, gva_mame_supports_sound ()); gconf_bridge_bind_property ( gconf_bridge_get (), GVA_GCONF_SOUND_MUTED, G_OBJECT (GVA_WIDGET_MAIN_MUTE_BUTTON), "muted"); gconf_bridge_bind_window ( gconf_bridge_get (), GVA_GCONF_WINDOW_PREFIX, GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW), TRUE, FALSE); /* Initialize the search entry. */ text = gva_main_get_last_search_text (); gtk_entry_set_text (GTK_ENTRY (GVA_WIDGET_MAIN_SEARCH_ENTRY), text); g_free (text); #if !GTK_CHECK_VERSION(2,14,0) && !defined WITH_GNOME /* Requires that we link against libgnome. */ gtk_action_set_sensitive (GVA_ACTION_CONTENTS, FALSE); #endif gtk_action_set_sensitive (GVA_ACTION_PROPERTIES, FALSE); gtk_action_set_sensitive (GVA_ACTION_RECORD, FALSE); gtk_action_set_sensitive (GVA_ACTION_SEARCH, FALSE); gtk_action_set_sensitive (GVA_ACTION_SHOW_CLONES, FALSE); gtk_action_set_sensitive (GVA_ACTION_START, FALSE); gtk_action_set_sensitive (GVA_ACTION_VIEW_AVAILABLE, FALSE); gtk_action_set_sensitive (GVA_ACTION_VIEW_FAVORITES, FALSE); gtk_action_set_sensitive (GVA_ACTION_VIEW_RESULTS, FALSE); gtk_action_set_visible (GVA_ACTION_INSERT_FAVORITE, FALSE); gtk_action_set_visible (GVA_ACTION_REMOVE_FAVORITE, FALSE); gtk_window_present (GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW)); }
int main (int argc, char **argv) { GConfBridge *bridge; GtkWidget *window, *vbox, *check, *entry, *label, *scale, *tree_view; GtkAdjustment *adjustment; GtkListStore *store; GtkCellRenderer *cell; gtk_init (&argc, &argv); bridge = gconf_bridge_get (); gconf_client_add_dir (gconf_bridge_get_client (bridge), "/apps/gconf-bridge-test", GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gconf_bridge_bind_window (bridge, "/apps/gconf-bridge-test/window", GTK_WINDOW (window), TRUE, TRUE); vbox = gtk_vbox_new (FALSE, 6); gtk_container_add (GTK_CONTAINER (window), vbox); check = gtk_check_button_new_with_label ("Check"); gtk_box_pack_start (GTK_BOX (vbox), check, TRUE, TRUE, 0); gconf_bridge_bind_property (bridge, "/apps/gconf-bridge-test/check", G_OBJECT (check), "active"); entry = gtk_entry_new (); gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0); gconf_bridge_bind_property (bridge, "/apps/gconf-bridge-test/text", G_OBJECT (entry), "text"); label = gtk_label_new ("Testing enums: Ellipsize mode"); gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0); gconf_bridge_bind_property (bridge, "/apps/gconf-bridge-test/ellipsize", G_OBJECT (label), "ellipsize"); scale = gtk_hscale_new_with_range (0.0, 10.0, 0.01); gtk_box_pack_start (GTK_BOX (vbox), scale, TRUE, TRUE, 0); adjustment = gtk_range_get_adjustment (GTK_RANGE (scale)); gconf_bridge_bind_property_delayed (bridge, "/apps/gconf-bridge-test/scale", G_OBJECT (adjustment), "value"); store = gtk_list_store_new (1, G_TYPE_STRING); tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); gconf_bridge_bind_string_list_store (bridge, "/apps/gconf-bridge-test/list", store); g_object_unref (store); cell = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view), -1, "List", cell, "text", 0, NULL); gtk_box_pack_start (GTK_BOX (vbox), tree_view, TRUE, TRUE, 0); gtk_widget_show_all (window); gtk_main (); return 0; }