static void listen_init (Listener* listener) { // Monitor "everything" listener->client = gconf_client_get_default(); gconf_client_add_dir( listener->client, "/", GCONF_CLIENT_PRELOAD_NONE, NULL ); // Set callback listener->cnxn_id = gconf_client_notify_add( listener->client, "/", entry_changed_callback, NULL, NULL, NULL ); }
static void gst_gconf_switch_profile (GstGConfAudioSink * sink, GstGConfProfile profile) { if (sink->client == NULL) return; if (sink->notify_id) { GST_DEBUG_OBJECT (sink, "Unsubscribing old key %s for profile %d", gst_gconf_get_key_for_sink_profile (sink->profile), sink->profile); gconf_client_notify_remove (sink->client, sink->notify_id); sink->notify_id = 0; } sink->profile = profile; if (profile != GCONF_PROFILE_NONE) { const gchar *key = gst_gconf_get_key_for_sink_profile (sink->profile); GST_DEBUG_OBJECT (sink, "Subscribing to key %s for profile %d", key, profile); sink->notify_id = gconf_client_notify_add (sink->client, key, cb_change_child, sink, NULL, NULL); } }
int main (int argc, char *argv[]) { setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); signal (SIGCHLD, on_sigchld); gtk_init (&argc, &argv); gconf_client = gconf_client_get_default (); gconf_client_add_dir (gconf_client, CONF_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL); gconf_client_notify_add (gconf_client, CONF_STASHES, on_change_conf_stashes, NULL, NULL, NULL); read_config (); check_requirements (); // festering mount points std::vector<CryptPoint>::iterator it; for (it = cryptPoints.begin (); it != cryptPoints.end (); ++it) { if (!config_keep_mountpoints) rmdir ((*it).GetMountDir ()); } sico = gtk_status_icon_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION); g_signal_connect(G_OBJECT(sico), "activate", G_CALLBACK(sico_activated), NULL); g_signal_connect(G_OBJECT(sico), "popup-menu", G_CALLBACK(sico_right_button_activated), NULL); create_stash_wizard = new CreateStashWizard (); import_stash_wizard = new ImportStashWizard (); config_dialog = new ConfigDialog (); gtk_main (); return 0; }
static void penge_grid_view_init (PengeGridView *self) { PengeGridViewPrivate *priv = GET_PRIVATE_REAL (self); GError *error = NULL; self->priv = priv; priv->header_label = mx_label_new_with_text ("Myzone"); clutter_actor_set_name (priv->header_label, "myzone-panel-header-label"); mx_table_insert_actor_with_properties (MX_TABLE (self), priv->header_label, 0, 0, "x-expand", FALSE, "y-expand", FALSE, "column-span", 3, NULL); priv->calendar_pane = g_object_new (PENGE_TYPE_CALENDAR_PANE, NULL); clutter_actor_set_width (priv->calendar_pane, 280); mx_table_insert_actor (MX_TABLE (self), priv->calendar_pane, 1, 0); priv->email_pane = g_object_new (PENGE_TYPE_EMAIL_PANE, NULL); mx_table_insert_actor (MX_TABLE (self), priv->email_pane, 2, 0); priv->favourite_apps_pane = g_object_new (PENGE_TYPE_APPS_PANE, NULL); mx_table_insert_actor (MX_TABLE (self), priv->favourite_apps_pane, 3, 0); priv->div_tex = clutter_texture_new_from_file (V_DIV_LINE, &error); if (!priv->div_tex) { g_warning (G_STRLOC ": Error loading vertical divider: %s", error->message); g_clear_error (&error); } else { mx_table_insert_actor (MX_TABLE (self), priv->div_tex, 1, 1); } priv->everything_pane = g_object_new (PENGE_TYPE_EVERYTHING_PANE, NULL); mx_table_insert_actor (MX_TABLE (self), priv->everything_pane, 1, 2); mx_table_set_row_spacing (MX_TABLE (self), 6); mx_table_set_column_spacing (MX_TABLE (self), 6); /* * Create a background and parent it to the grid. We paint and allocate this * in the overridden vfuncs */ priv->background = g_object_new (PENGE_TYPE_VIEW_BACKGROUND, NULL); clutter_actor_set_parent (priv->background, (ClutterActor *)self); clutter_actor_show (priv->background); priv->background_fade = clutter_texture_new_from_file (FADE_BG, NULL); clutter_actor_set_parent (priv->background_fade, (ClutterActor *)self); clutter_actor_show (priv->background_fade); priv->gconf_client = gconf_client_get_default (); priv->show_calendar_notify_id = gconf_client_notify_add (priv->gconf_client, MEEGO_MYZONE_SHOW_CALENDAR, _gconf_show_calendar_notify_cb, self, NULL, &error); if (error) { g_warning (G_STRLOC ": Error setting gconf key notification: %s", error->message); g_clear_error (&error); } else { gconf_client_notify (priv->gconf_client, MEEGO_MYZONE_SHOW_CALENDAR); } priv->show_email_notify_id = gconf_client_notify_add (priv->gconf_client, MEEGO_MYZONE_SHOW_EMAIL, _gconf_show_email_notify_cb, self, NULL, &error); if (error) { g_warning (G_STRLOC ": Error setting gconf key notification: %s", error->message); g_clear_error (&error); } else { gconf_client_notify (priv->gconf_client, MEEGO_MYZONE_SHOW_EMAIL); } }
static void cb_show_details (GtkWidget *button, AppearanceData *data) { if (!data->font_details) { GtkAdjustment *adjustment; GtkWidget *widget; EnumGroup *group; data->font_details = glade_xml_get_widget (data->xml, "render_details"); gtk_window_set_transient_for (GTK_WINDOW (data->font_details), GTK_WINDOW (glade_xml_get_widget (data->xml, "appearance_window"))); widget = glade_xml_get_widget (data->xml, "dpi_spinner"); /* pick a sensible maximum dpi */ adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); adjustment->upper = DPI_HIGH_REASONABLE_VALUE; dpi_load (data->client, GTK_SPIN_BUTTON (widget)); g_signal_connect (widget, "value_changed", G_CALLBACK (dpi_value_changed), data->client); gconf_client_notify_add (data->client, FONT_DPI_KEY, dpi_changed, widget, NULL, NULL); setup_font_sample (glade_xml_get_widget (data->xml, "antialias_none_sample"), ANTIALIAS_NONE, HINT_FULL); setup_font_sample (glade_xml_get_widget (data->xml, "antialias_grayscale_sample"), ANTIALIAS_GRAYSCALE, HINT_FULL); setup_font_sample (glade_xml_get_widget (data->xml, "antialias_subpixel_sample"), ANTIALIAS_RGBA, HINT_FULL); group = enum_group_create ( FONT_ANTIALIASING_KEY, antialias_enums, ANTIALIAS_GRAYSCALE, glade_xml_get_widget (data->xml, "antialias_none_radio"), ANTIALIAS_NONE, glade_xml_get_widget (data->xml, "antialias_grayscale_radio"), ANTIALIAS_GRAYSCALE, glade_xml_get_widget (data->xml, "antialias_subpixel_radio"), ANTIALIAS_RGBA, NULL); data->font_groups = g_slist_prepend (data->font_groups, group); setup_font_sample (glade_xml_get_widget (data->xml, "hint_none_sample"), ANTIALIAS_GRAYSCALE, HINT_NONE); setup_font_sample (glade_xml_get_widget (data->xml, "hint_slight_sample"), ANTIALIAS_GRAYSCALE, HINT_SLIGHT); setup_font_sample (glade_xml_get_widget (data->xml, "hint_medium_sample"), ANTIALIAS_GRAYSCALE, HINT_MEDIUM); setup_font_sample (glade_xml_get_widget (data->xml, "hint_full_sample"), ANTIALIAS_GRAYSCALE, HINT_FULL); group = enum_group_create ( FONT_HINTING_KEY, hint_enums, HINT_FULL, glade_xml_get_widget (data->xml, "hint_none_radio"), HINT_NONE, glade_xml_get_widget (data->xml, "hint_slight_radio"), HINT_SLIGHT, glade_xml_get_widget (data->xml, "hint_medium_radio"), HINT_MEDIUM, glade_xml_get_widget (data->xml, "hint_full_radio"), HINT_FULL, NULL); data->font_groups = g_slist_prepend (data->font_groups, group); gtk_image_set_from_file (GTK_IMAGE (glade_xml_get_widget (data->xml, "subpixel_rgb_image")), GNOMECC_PIXMAP_DIR "/subpixel-rgb.png"); gtk_image_set_from_file (GTK_IMAGE (glade_xml_get_widget (data->xml, "subpixel_bgr_image")), GNOMECC_PIXMAP_DIR "/subpixel-bgr.png"); gtk_image_set_from_file (GTK_IMAGE (glade_xml_get_widget (data->xml, "subpixel_vrgb_image")), GNOMECC_PIXMAP_DIR "/subpixel-vrgb.png"); gtk_image_set_from_file (GTK_IMAGE (glade_xml_get_widget (data->xml, "subpixel_vbgr_image")), GNOMECC_PIXMAP_DIR "/subpixel-vbgr.png"); group = enum_group_create ( FONT_RGBA_ORDER_KEY, rgba_order_enums, RGBA_RGB, glade_xml_get_widget (data->xml, "subpixel_rgb_radio"), RGBA_RGB, glade_xml_get_widget (data->xml, "subpixel_bgr_radio"), RGBA_BGR, glade_xml_get_widget (data->xml, "subpixel_vrgb_radio"), RGBA_VRGB, glade_xml_get_widget (data->xml, "subpixel_vbgr_radio"), RGBA_VBGR, NULL); data->font_groups = g_slist_prepend (data->font_groups, group); g_signal_connect (G_OBJECT (data->font_details), "response", G_CALLBACK (cb_details_response), NULL); g_signal_connect (G_OBJECT (data->font_details), "delete_event", G_CALLBACK (gtk_true), NULL); } gtk_window_present (GTK_WINDOW (data->font_details)); }
/** * gconf_bridge_bind_string_list_store * @bridge: A #GConfBridge * @key: A GConf key to be bound * @list_store: A #GtkListStore * * On calling this function single string column #GtkListStore @list_store * will be kept synchronized with the GConf string list value pointed to by * @key. On calling this function @list_store will be populated with the * strings specified by the value of @key. * * Return value: The ID of the new binding. **/ guint gconf_bridge_bind_string_list_store (GConfBridge *bridge, const char *key, GtkListStore *list_store) { GtkTreeModel *tree_model; gboolean have_one_column, is_string_column; ListStoreBinding *binding; GConfValue *val; g_return_val_if_fail (bridge != NULL, 0); g_return_val_if_fail (key != NULL, 0); g_return_val_if_fail (GTK_IS_LIST_STORE (list_store), 0); /* Check list store suitability */ tree_model = GTK_TREE_MODEL (list_store); have_one_column = (gtk_tree_model_get_n_columns (tree_model) == 1); is_string_column = (gtk_tree_model_get_column_type (tree_model, 0) == G_TYPE_STRING); if (G_UNLIKELY (!have_one_column || !is_string_column)) { g_warning ("gconf_bridge_bind_string_list_store: Only " "GtkListStores with exactly one string column are " "supported."); return 0; } /* Create new binding. */ binding = g_new (ListStoreBinding, 1); binding->type = BINDING_LIST_STORE; binding->id = new_id (); binding->key = g_strdup (key); binding->val_changes = NULL; binding->list_store = list_store; binding->sync_idle_id = 0; /* Watch GConf key */ binding->val_notify_id = gconf_client_notify_add (bridge->client, key, list_store_binding_pref_changed, binding, NULL, NULL); /* Connect to ListStore change notifications */ binding->row_inserted_id = g_signal_connect_swapped (list_store, "row-inserted", G_CALLBACK (list_store_binding_store_changed_cb), binding); binding->row_changed_id = g_signal_connect_swapped (list_store, "row-inserted", G_CALLBACK (list_store_binding_store_changed_cb), binding); binding->row_deleted_id = g_signal_connect_swapped (list_store, "row-inserted", G_CALLBACK (list_store_binding_store_changed_cb), binding); binding->rows_reordered_id = g_signal_connect_swapped (list_store, "row-inserted", G_CALLBACK (list_store_binding_store_changed_cb), binding); /* Sync object to value from GConf, if set */ val = gconf_client_get (bridge->client, key, NULL); if (val) { list_store_binding_sync_pref_to_store (binding, val); gconf_value_free (val); } /* Handle case where watched object gets destroyed */ g_object_weak_ref (G_OBJECT (list_store), list_store_binding_store_destroyed, binding); /* Insert binding */ g_hash_table_insert (bridge->bindings, GUINT_TO_POINTER (binding->id), binding); /* Done */ return binding->id; }
/** * gconf_bridge_bind_property_full * @bridge: A #GConfBridge * @key: A GConf key to be bound * @object: A #GObject * @prop: The property of @object to be bound * @delayed_sync: TRUE if there should be a delay between property changes * and syncs to GConf. Set to TRUE when binding to a rapidly-changing * property, for example the "value" property on a #GtkAdjustment. * * Binds @key to @prop, causing them to have the same value at all times. * * The types of @key and @prop should be compatible. Floats and doubles, and * ints, uints, longs, unlongs, int64s, uint64s, chars, uchars and enums * can be matched up. Booleans and strings can only be matched to their * respective types. * * On calling this function the current value of @key will be set to @prop. * * Return value: The ID of the new binding. **/ guint gconf_bridge_bind_property_full (GConfBridge *bridge, const char *key, GObject *object, const char *prop, gboolean delayed_sync) { GParamSpec *pspec; PropBinding *binding; char *signal; GConfValue *val; g_return_val_if_fail (bridge != NULL, 0); g_return_val_if_fail (key != NULL, 0); g_return_val_if_fail (G_IS_OBJECT (object), 0); g_return_val_if_fail (prop != NULL, 0); /* First, try to fetch the propertys GParamSpec off the object */ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), prop); if (G_UNLIKELY (pspec == NULL)) { g_warning ("gconf_bridge_bind_property_full: A property \"%s\" " "was not found. Please make sure you are passing " "the right property name.", prop); return 0; } /* GParamSpec found: All good, create new binding. */ binding = g_new (PropBinding, 1); binding->type = BINDING_PROP; binding->id = new_id (); binding->delayed_mode = delayed_sync; binding->val_changes = NULL; binding->key = g_strdup (key); binding->object = object; binding->prop = pspec; binding->sync_timeout_id = 0; /* Watch GConf key */ binding->val_notify_id = gconf_client_notify_add (bridge->client, key, prop_binding_pref_changed, binding, NULL, NULL); /* Connect to property change notifications */ signal = g_strconcat ("notify::", prop, NULL); binding->prop_notify_id = g_signal_connect (object, signal, G_CALLBACK (prop_binding_prop_changed), binding); g_free (signal); /* Sync object to value from GConf, if set */ val = gconf_client_get (bridge->client, key, NULL); if (val) { prop_binding_sync_pref_to_prop (binding, val); gconf_value_free (val); } /* Handle case where watched object gets destroyed */ g_object_weak_ref (object, prop_binding_object_destroyed, binding); /* Insert binding */ g_hash_table_insert (bridge->bindings, GUINT_TO_POINTER (binding->id), binding); /* Done */ return binding->id; }
void switcher_button_init(SwitcherButton *self) { self->priv = SWITCHER_BUTTON_GET_PRIVATE(self); self->priv->osso = osso_initialize("layoutswitcher", VERSION, 0, 0); self->priv->model = tabletModel(); switch (self->priv->model) { case N800: printf("800\n"); break; case N810: printf("810\n"); break; case N900: printf("900\n"); break; case N770: printf("770\n"); break; } self->priv->locked = 0; self->priv->theme = gtk_icon_theme_get_default(); self->priv->lock = gtk_icon_theme_load_icon(self->priv->theme, "layoutswitcher-lock", 40, (GtkIconLookupFlags)0, 0); self->priv->icon0 = 0; self->priv->icon1 = 0; self->priv->gconfClient = gconf_client_get_default(); if (self->priv->model == N800 || self->priv->model == N810) { gconf_client_add_dir(self->priv->gconfClient, GCONF_DIR_2008, GCONF_CLIENT_PRELOAD_NONE, 0); self->priv->gconfNotifyCurrent = gconf_client_notify_add(self->priv->gconfClient, GCONF_CURRENT_2008, switcher_button_on_current_changed, self, 0, 0); self->priv->gconfNotifyLang0 = gconf_client_notify_add(self->priv->gconfClient, GCONF_LANG0_2008, switcher_button_on_language_changed, self, 0, 0); self->priv->gconfNotifyLang1 = gconf_client_notify_add(self->priv->gconfClient, GCONF_LANG1_2008, switcher_button_on_language_changed, self, 0, 0); } else if (self->priv->model == N770) { gconf_client_add_dir(self->priv->gconfClient, GCONF_DIR_2006, GCONF_CLIENT_PRELOAD_NONE, 0); self->priv->gconfNotifyCurrent = gconf_client_notify_add(self->priv->gconfClient, GCONF_CURRENT_2006, switcher_button_on_current_changed, self, 0, 0); self->priv->gconfNotifyLang0 = gconf_client_notify_add(self->priv->gconfClient, GCONF_LANG0_2006, switcher_button_on_language_changed, self, 0, 0); self->priv->gconfNotifyLang1 = gconf_client_notify_add(self->priv->gconfClient, GCONF_LANG1_2006, switcher_button_on_language_changed, self, 0, 0); } gconf_client_add_dir(self->priv->gconfClient, GCONF_LOCK_DIR, GCONF_CLIENT_PRELOAD_NONE, 0); self->priv->gconfNotifyLock = gconf_client_notify_add(self->priv->gconfClient, GCONF_LOCK_ENTRY, switcher_button_on_lock_changed, self, 0, 0); self->priv->menu = gtk_menu_new(); self->priv->menuItemCopy = gtk_menu_item_new_with_label("Copy text"); self->priv->menuItemBlock= gtk_check_menu_item_new_with_label("Block keyboard"); g_signal_connect(G_OBJECT(self->priv->menuItemCopy), "activate", G_CALLBACK(switcher_button_on_copy_menu), self); g_signal_connect(G_OBJECT(self->priv->menuItemBlock), "activate", G_CALLBACK(switcher_button_on_block_menu), self); gtk_menu_shell_append(GTK_MENU_SHELL(self->priv->menu), self->priv->menuItemCopy); gtk_menu_shell_append(GTK_MENU_SHELL(self->priv->menu), self->priv->menuItemBlock); gtk_widget_show_all(self->priv->menu); g_signal_connect(G_OBJECT(self), "clicked", G_CALLBACK(switcher_button_on_click), 0); if (self->priv->model == N770) { g_signal_connect(G_OBJECT(self), "tap-and-hold", G_CALLBACK(switcher_button_on_tap_and_hold), 0); gtk_widget_tap_and_hold_setup(GTK_WIDGET(self), 0, 0, 0); } else { // g_signal_connect(G_OBJECT(self), "tap-and-hold", G_CALLBACK(switcher_button_on_tap_and_hold), 0); gtk_widget_tap_and_hold_setup(GTK_WIDGET(self), self->priv->menu, 0, 0); } g_signal_connect_after(G_OBJECT(self), "expose-event", G_CALLBACK(switcher_button_on_expose), 0); switcher_button_update_languages(self); }
/* Config struct routines */ void mail_config_init (EMailSession *session) { GConfClient *client; GConfClientNotifyFunc func; const gchar *key; g_return_if_fail (E_IS_MAIL_SESSION (session)); if (config) return; config = g_new0 (MailConfig, 1); client = gconf_client_get_default (); gconf_client_add_dir ( client, "/apps/evolution/mail/prompts", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); /* Composer Configuration */ gconf_client_add_dir ( client, "/apps/evolution/mail/composer", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); key = "/apps/evolution/mail/composer/outlook_filenames"; func = (GConfClientNotifyFunc) gconf_outlook_filenames_changed; gconf_outlook_filenames_changed (client, 0, NULL, NULL); gconf_client_notify_add (client, key, func, NULL, NULL, NULL); /* Display Configuration */ gconf_client_add_dir ( client, "/apps/evolution/mail/display", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); key = "/apps/evolution/mail/display/address_compress"; func = (GConfClientNotifyFunc) gconf_bool_value_changed; gconf_client_notify_add ( client, key, func, &config->address_compress, NULL, NULL); config->address_compress = gconf_client_get_bool (client, key, NULL); key = "/apps/evolution/mail/display/address_count"; func = (GConfClientNotifyFunc) gconf_int_value_changed; gconf_client_notify_add ( client, key, func, &config->address_count, NULL, NULL); config->address_count = gconf_client_get_int (client, key, NULL); /* Font Configuration */ gconf_client_add_dir ( client, "/apps/evolution/mail/display/fonts", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); /* Junk Configuration */ gconf_client_add_dir ( client, "/apps/evolution/mail/junk", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); key = "/apps/evolution/mail/junk/check_custom_header"; func = (GConfClientNotifyFunc) gconf_jh_check_changed; gconf_client_notify_add (client, key, func, session, NULL, NULL); config->jh_check = gconf_client_get_bool (client, key, NULL); key = "/apps/evolution/mail/junk/custom_header"; func = (GConfClientNotifyFunc) gconf_jh_headers_changed; gconf_client_notify_add (client, key, func, session, NULL, NULL); key = "/apps/evolution/mail/junk/lookup_addressbook"; func = (GConfClientNotifyFunc) gconf_bool_value_changed; gconf_client_notify_add ( client, key, func, &config->book_lookup, NULL, NULL); config->book_lookup = gconf_client_get_bool (client, key, NULL); key = "/apps/evolution/mail/junk/lookup_addressbook_local_only"; func = (GConfClientNotifyFunc) gconf_bool_value_changed; gconf_client_notify_add ( client, key, func, &config->book_lookup_local_only, NULL, NULL); config->book_lookup_local_only = gconf_client_get_bool (client, key, NULL); gconf_jh_check_changed (client, 0, NULL, session); g_object_unref (client); }
static void mnb_toolbar_clock_update_time_date (MnbToolbarClock *clock) { MnbToolbarClockPrivate *priv = clock->priv; time_t t; struct tm *tmp; char time_str[64]; static gboolean setup_done = FALSE; GConfClient *client; char *time_ptr; if (priv->disposed) return; client = gconf_client_get_default (); t = time (NULL); tmp = localtime (&t); if (tmp) { gboolean c24h = gconf_client_get_bool (client, MNB_24H_KEY, NULL); if (c24h) { /* translators: translate this to a suitable 24 hourt time format for * your locale showing only hours and minutes. For available format * specifiers see * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html */ strftime (time_str, 64, _("%H:%M"), tmp); } else { /* translators: translate this to a suitable default time format for * your locale showing only hours and minutes. For available format * specifiers see * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html */ strftime (time_str, 64, _("%l:%M %P"), tmp); } } else snprintf (time_str, 64, "Time"); /* * Strip leading space, if any. */ if (time_str[0] == ' ') time_ptr = &time_str[1]; else time_ptr = &time_str[0]; mx_button_set_label (MX_BUTTON (clock), time_ptr); if (tmp) /* translators: translate this to a suitable date format for your locale. * For availabe format specifiers see * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html */ strftime (time_str, 64, _("%B %e, %Y"), tmp); else snprintf (time_str, 64, "Date"); mx_widget_set_tooltip_text (MX_WIDGET (clock), time_str); if (!setup_done) { GError *error = NULL; setup_done = TRUE; gconf_client_add_dir (client, MNB_24H_KEY_DIR, GCONF_CLIENT_PRELOAD_NONE, &error); if (error) { g_warning (G_STRLOC ": Error when adding directory " MNB_24H_KEY_DIR " for notification: %s", error->message); g_clear_error (&error); } gconf_client_notify_add (client, MNB_24H_KEY, mnb_toolbar_clock_format_changed_cb, clock, NULL, &error); if (error) { g_warning (G_STRLOC ": Error when adding key " MNB_24H_KEY " for notification: %s", error->message); g_clear_error (&error); } } g_object_unref (client); }
static void gconf_bookmarks_dialog_init (GConfBookmarksDialog *dialog) { GtkWidget *scrolled_window, *hbox, *vbox; GtkWidget *content_area; GtkCellRenderer *cell; GtkTreeViewColumn *column; GConfClient *client; hbox = gtk_hbox_new (FALSE, 6); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (content_area), 2); gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 200); gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); gtk_window_set_title (GTK_WINDOW (dialog), _("Edit Bookmarks")); dialog->list_store = gtk_list_store_new (1, G_TYPE_STRING); g_signal_connect (dialog->list_store, "row_deleted", G_CALLBACK (gconf_bookmarks_dialog_row_deleted), dialog); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_box_pack_start (GTK_BOX (hbox), scrolled_window, TRUE, TRUE, 0); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); dialog->tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (dialog->list_store)); gtk_tree_view_set_reorderable (GTK_TREE_VIEW (dialog->tree_view), TRUE); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->tree_view)), "changed", G_CALLBACK (gconf_bookmarks_dialog_selection_changed), dialog); gconf_bookmarks_dialog_populate_model (dialog); column = gtk_tree_view_column_new (); cell = gtk_cell_renderer_pixbuf_new (); g_object_set (G_OBJECT (cell), "stock-id", STOCK_BOOKMARK, NULL); gtk_tree_view_column_pack_start (column, cell, FALSE); cell = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (column, cell, TRUE); gtk_tree_view_column_set_attributes (column, cell, "text", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->tree_view), column); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dialog->tree_view), FALSE); g_object_unref (dialog->list_store); gtk_container_add (GTK_CONTAINER (scrolled_window), dialog->tree_view); vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); dialog->delete_button = gtk_button_new_from_stock (GTK_STOCK_DELETE); gtk_widget_set_sensitive (dialog->delete_button, FALSE); g_signal_connect (dialog->delete_button, "clicked", G_CALLBACK (gconf_bookmarks_dialog_delete_bookmark), dialog); gtk_box_pack_start (GTK_BOX (vbox), dialog->delete_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0); gtk_widget_show_all (hbox); /* Listen for gconf changes */ client = gconf_client_get_default (); gconf_client_add_dir (client, BOOKMARKS_KEY, GCONF_CLIENT_PRELOAD_NONE, NULL); dialog->notify_id = gconf_client_notify_add (client, BOOKMARKS_KEY, gconf_bookmarks_dialog_bookmarks_key_changed, dialog, NULL, NULL); g_object_unref (client); }
int main(int argc, char *argv[]) { cam cam_object, *cam; Display *display; Screen *screen_num; gchar *poopoo = NULL; gchar *pixfilename = "camorama/camorama.png"; gchar *filename; //= "/usr/opt/garnome/share/camorama/camorama.glade"; int x = -1, y = -1; gboolean buggery = FALSE; GtkWidget *button; GConfClient *gc; const struct poptOption popt_options[] = { {"version", 'V', POPT_ARG_NONE, &ver, 0, N_("show version and exit"), NULL}, {"device", 'd', POPT_ARG_STRING, &poopoo, 0, N_("v4l device to use"), NULL}, {"debug", 'D', POPT_ARG_NONE, &buggery, 0, N_("enable debugging code"), NULL}, {"width", 'x', POPT_ARG_INT, &x, 0, N_("capture width"), NULL}, {"height", 'y', POPT_ARG_INT, &y, 0, N_("capture height"), NULL}, {"max", 'M', POPT_ARG_NONE, &max, 0, N_("maximum capture size"), NULL}, {"min", 'm', POPT_ARG_NONE, &min, 0, N_("minimum capture size"), NULL}, {"half", 'H', POPT_ARG_NONE, &half, 0, N_("middle capture size"), NULL}, {"read", 'R', POPT_ARG_NONE, &use_read, 0, N_("use read() rather than mmap()"), NULL}, POPT_TABLEEND }; cam = &cam_object; /* set some default values */ cam->frame_number = 0; cam->pic = NULL; cam->pixmap = NULL; cam->size = PICHALF; cam->video_dev = NULL; cam->read = FALSE; bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); setlocale (LC_ALL, ""); /* gnome_program_init - initialize everything (gconf, threads, etc) */ gnome_program_init (PACKAGE_NAME, PACKAGE_VERSION, LIBGNOMEUI_MODULE, argc, argv, GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR, GNOME_PARAM_POPT_TABLE, popt_options, GNOME_PARAM_HUMAN_READABLE_NAME, _("camorama"), NULL); /* gtk is initialized now */ camorama_stock_init(); camorama_filters_init(); cam->debug = buggery; cam->x = x; cam->y = y; glade_gnome_init (); glade_set_custom_handler (camorama_glade_handler, cam); if (ver) { fprintf (stderr, _("\n\nCamorama version %s\n\n"), VERSION); exit (0); } if (max) { cam->size = PICMAX; } if (min) { cam->size = PICMIN; } if (half) { cam->size = PICHALF; } if (use_read) { printf ("gah!\n"); cam->read = TRUE; } gc = gconf_client_get_default (); cam->gc = gc; gconf_client_add_dir (cam->gc, PATH, GCONF_CLIENT_PRELOAD_NONE, NULL); gconf_client_notify_add (cam->gc, KEY1, (void *) gconf_notify_func, cam->pixdir, NULL, NULL); gconf_client_notify_add (cam->gc, KEY5, (void *) gconf_notify_func, cam->rhost, NULL, NULL); gconf_client_notify_add (cam->gc, KEY2, (void *) gconf_notify_func, cam->capturefile, NULL, NULL); gconf_client_notify_add (cam->gc, KEY3, (void *) gconf_notify_func_int, GINT_TO_POINTER (cam->savetype), NULL, NULL); gconf_client_notify_add (cam->gc, KEY4, (void *) gconf_notify_func_bool, &cam->timestamp, NULL, NULL); if (!poopoo) { gchar const* gconf_device = gconf_client_get_string(cam->gc, KEY_DEVICE, NULL); if(gconf_device) { cam->video_dev = g_strdup(gconf_device); } else { cam->video_dev = g_strdup ("/dev/video0"); } } else { cam->video_dev = g_strdup (poopoo); } cam->pixdir = g_strdup (gconf_client_get_string (cam->gc, KEY1, NULL)); cam->capturefile = g_strdup (gconf_client_get_string (cam->gc, KEY2, NULL)); cam->rhost = g_strdup (gconf_client_get_string (cam->gc, KEY5, NULL)); cam->rlogin = g_strdup (gconf_client_get_string (cam->gc, KEY6, NULL)); cam->rpw = g_strdup (gconf_client_get_string (cam->gc, KEY7, NULL)); cam->rpixdir = g_strdup (gconf_client_get_string (cam->gc, KEY8, NULL)); cam->rcapturefile = g_strdup (gconf_client_get_string (cam->gc, KEY9, NULL)); cam->savetype = gconf_client_get_int (cam->gc, KEY3, NULL); cam->rsavetype = gconf_client_get_int (cam->gc, KEY10, NULL); cam->ts_string = g_strdup (gconf_client_get_string (cam->gc, KEY16, NULL)); cam->date_format = "%Y-%m-%d %H:%M:%S"; cam->timestamp = gconf_client_get_bool (cam->gc, KEY4, NULL); cam->rtimestamp = gconf_client_get_bool (cam->gc, KEY11, NULL); cam->cap = gconf_client_get_bool (cam->gc, KEY12, NULL); cam->rcap = gconf_client_get_bool (cam->gc, KEY13, NULL); cam->timefn = gconf_client_get_bool (cam->gc, KEY14, NULL); cam->rtimefn = gconf_client_get_bool (cam->gc, KEY15, NULL); cam->usestring = gconf_client_get_bool (cam->gc, KEY18, NULL); cam->usedate = gconf_client_get_bool (cam->gc, KEY19, NULL); cam->acap = gconf_client_get_bool (cam->gc, KEY20, NULL); cam->timeout_interval = gconf_client_get_int (cam->gc, KEY21, NULL); cam->show_adjustments = gconf_client_get_bool (cam->gc, KEY22, NULL); cam->show_effects = gconf_client_get_bool (cam->gc, KEY23, NULL); /* get desktop depth */ display = (Display *) gdk_x11_get_default_xdisplay (); screen_num = xlib_rgb_get_screen (); gdk_pixbuf_xlib_init (display, 0); cam->desk_depth = xlib_rgb_get_depth (); cam->dev = open (cam->video_dev, O_RDWR); camera_cap (cam); get_win_info (cam); /* query/set window attributes */ cam->vid_win.x = 0; cam->vid_win.y = 0; cam->vid_win.width = cam->x; cam->vid_win.height = cam->y; cam->vid_win.chromakey = 0; cam->vid_win.flags = 0; set_win_info (cam); get_win_info (cam); /* get picture attributes */ get_pic_info (cam); // set_pic_info(cam); /* set_pic_info(cam); */ cam->contrast = cam->vid_pic.contrast; cam->brightness = cam->vid_pic.brightness; cam->colour = cam->vid_pic.colour; cam->hue = cam->vid_pic.hue; cam->wb = cam->vid_pic.whiteness; cam->depth = cam->vid_pic.depth / 8; cam->pic_buf = malloc (cam->x * cam->y * cam->depth); cam->tmp = malloc (cam->vid_cap.maxwidth * cam->vid_cap.maxheight * cam->depth); //cam->tmp = NULL; /* set the buffer size */ if (cam->read == FALSE) { set_buffer (cam); } //cam->read = FALSE; /* initialize cam and create the window */ if (cam->read == FALSE) { pt2Function = timeout_func; init_cam (NULL, cam); } else { printf ("using read()\n"); cam->pic = realloc (cam->pic, (cam->vid_cap.maxwidth * cam->vid_cap.maxheight * 3)); pt2Function = read_timeout_func; } cam->pixmap = gdk_pixmap_new (NULL, cam->x, cam->y, cam->desk_depth); filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_DATADIR, "camorama/camorama.glade", TRUE, NULL); if (filename == NULL) { error_dialog (_ ("Couldn't find the main interface file (camorama.glade).")); exit (1); } //pixfilename = gnome_program_locate_file(NULL, GNOME_FILE_DOMAIN_APP_DATADIR, "pixmaps/camorama.png", TRUE, NULL); //printf("pixfile = %s\n",pixfilename); //pixfilename); //printf("pixfile = %s\n",pixfilename); cam->xml = glade_xml_new (filename, NULL, NULL); /*eggtray */ /*tray_icon = egg_tray_icon_new ("Our other cool tray icon"); * button = gtk_button_new_with_label ("This is a another\ncool tray icon"); * g_signal_connect (button, "clicked", * G_CALLBACK (second_button_pressed), tray_icon); * * gtk_container_add (GTK_CONTAINER (tray_icon), button); * gtk_widget_show_all (GTK_WIDGET (tray_icon)); */ load_interface (cam); cam->idle_id = gtk_idle_add ((GSourceFunc) pt2Function, (gpointer) cam); gtk_timeout_add (2000, (GSourceFunc) fps, cam->status); gtk_main (); return 0; }
int main (int argc, char *argv[]) { GtkWidget *label; GdkPixbuf *icon_pixbuf; GError *err = NULL; bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); srand (time(NULL)); gnome_program_init (APPID, APPVERSION, LIBGNOMEUI_MODULE, argc, argv, GNOME_PARAM_POPT_TABLE, options, GNOME_PARAM_NONE); textbox_setup (); /* needs to be done before text boxes are created */ /* Initialize the GConf library */ if (!gconf_init (argc, argv, &err)) { fprintf (stderr, _("Failed to init GConf: %s\n"), err->message); g_error_free (err); err = NULL; } /* Start a GConf client */ gconf_client = gconf_client_get_default (); /* Add the GTetrinet directories to the list of directories that GConf client must watch */ gconf_client_add_dir (gconf_client, "/apps/gtetrinet/sound", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (gconf_client, "/apps/gtetrinet/themes", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (gconf_client, "/apps/gtetrinet/keys", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (gconf_client, "/apps/gtetrinet/partyline", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); /* Request notification of change for these gconf keys */ gconf_client_notify_add (gconf_client, "/apps/gtetrinet/sound/midi_player", (GConfClientNotifyFunc) sound_midi_player_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/sound/enable_sound", (GConfClientNotifyFunc) sound_enable_sound_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/sound/enable_midi", (GConfClientNotifyFunc) sound_enable_midi_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/themes/theme_dir", (GConfClientNotifyFunc) themes_theme_dir_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/down", (GConfClientNotifyFunc) keys_down_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/left", (GConfClientNotifyFunc) keys_left_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/right", (GConfClientNotifyFunc) keys_right_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/rotate_left", (GConfClientNotifyFunc) keys_rotate_left_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/rotate_right", (GConfClientNotifyFunc) keys_rotate_right_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/drop", (GConfClientNotifyFunc) keys_drop_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/message", (GConfClientNotifyFunc) keys_message_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/discard", (GConfClientNotifyFunc) keys_discard_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special1", (GConfClientNotifyFunc) keys_special1_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special2", (GConfClientNotifyFunc) keys_special2_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special3", (GConfClientNotifyFunc) keys_special3_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special4", (GConfClientNotifyFunc) keys_special4_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special5", (GConfClientNotifyFunc) keys_special5_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special6", (GConfClientNotifyFunc) keys_special6_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special_self", (GConfClientNotifyFunc) keys_special_self_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps", (GConfClientNotifyFunc) partyline_enable_timestamps_changed, NULL, NULL, NULL); gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_channel_list", (GConfClientNotifyFunc) partyline_enable_channel_list_changed, NULL, NULL, NULL); /* load settings */ config_loadconfig (); /* initialise some stuff */ fields_init (); if (!g_thread_supported()) g_thread_init (NULL); /* first set up the display */ /* create the main window */ app = gnome_app_new (APPID, APPNAME); g_signal_connect (G_OBJECT(app), "destroy", GTK_SIGNAL_FUNC(destroymain), NULL); keypress_signal = g_signal_connect (G_OBJECT(app), "key-press-event", GTK_SIGNAL_FUNC(keypress), NULL); g_signal_connect (G_OBJECT(app), "key-release-event", GTK_SIGNAL_FUNC(keyrelease), NULL); gtk_widget_set_events (app, GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK); gtk_window_set_resizable (GTK_WINDOW (app), TRUE); /* create and set the window icon */ icon_pixbuf = gdk_pixbuf_new_from_file (PIXMAPSDIR "/gtetrinet.png", NULL); if (icon_pixbuf) { gtk_window_set_icon (GTK_WINDOW (app), icon_pixbuf); gdk_pixbuf_unref (icon_pixbuf); } /* create the notebook */ notebook = gtk_notebook_new (); gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP); /* put it in the main window */ gnome_app_set_contents (GNOME_APP(app), notebook); /* make menus + toolbar */ make_menus (GNOME_APP(app)); /* create the pages in the notebook */ fieldswidget = fields_page_new (); gtk_widget_set_sensitive (fieldswidget, TRUE); gtk_widget_show (fieldswidget); pfields = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER(pfields), 0); gtk_container_add (GTK_CONTAINER(pfields), fieldswidget); gtk_widget_show (pfields); g_object_set_data (G_OBJECT(fieldswidget), "title", "Playing Fields"); // FIXME label = pixmapdata_label (fields_xpm, _("Playing Fields")); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK(notebook), pfields, label); partywidget = partyline_page_new (); gtk_widget_show (partywidget); pparty = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER(pparty), 0); gtk_container_add (GTK_CONTAINER(pparty), partywidget); gtk_widget_show (pparty); g_object_set_data (G_OBJECT(partywidget), "title", "Partyline"); // FIXME label = pixmapdata_label (partyline_xpm, _("Partyline")); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK(notebook), pparty, label); winlistwidget = winlist_page_new (); gtk_widget_show (winlistwidget); pwinlist = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER(pwinlist), 0); gtk_container_add (GTK_CONTAINER(pwinlist), winlistwidget); gtk_widget_show (pwinlist); g_object_set_data (G_OBJECT(winlistwidget), "title", "Winlist"); // FIXME label = pixmapdata_label (winlist_xpm, _("Winlist")); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK(notebook), pwinlist, label); /* add signal to focus the text entry when switching to the partyline page*/ g_signal_connect_after(G_OBJECT (notebook), "switch-page", GTK_SIGNAL_FUNC (switch_focus), NULL); gtk_widget_show (notebook); g_object_set (G_OBJECT (notebook), "can-focus", FALSE, NULL); partyline_show_channel_list (list_enabled); gtk_widget_show (app); // gtk_widget_set_size_request (partywidget, 480, 360); // gtk_widget_set_size_request (winlistwidget, 480, 360); /* initialise some stuff */ commands_checkstate (); /* check command line params */ #ifdef DEBUG printf ("option_connect: %s\n" "option_nick: %s\n" "option_team: %s\n" "option_pass: %s\n" "option_spec: %i\n", option_connect, option_nick, option_team, option_pass, option_spec); #endif if (option_nick) GTET_O_STRCPY(nick, option_nick); if (option_team) GTET_O_STRCPY(team, option_team); if (option_pass) GTET_O_STRCPY(specpassword, option_pass); if (option_spec) spectating = TRUE; if (option_connect) { client_init (option_connect, nick); } /* Don't schedule if data is ready, glib should do this itself, * but welcome to anything that works... */ g_main_context_set_poll_func(NULL, gtetrinet_poll_func); /* gtk_main() */ gtk_main (); client_disconnect (); /* cleanup */ fields_cleanup (); sound_stopmidi (); return 0; }
int main (int argc, char **argv) { #ifdef USE_GCONF GConfClient *gconf; #endif char *dir; struct sigaction action; sigset_t sigset; main_status = QUARK_STARTING; /* initialize the locale */ if (!setlocale(LC_ALL, "")) g_warning("Couldn't set locale from environment.\n"); bindtextdomain(PACKAGE_NAME, LOCALEDIR); bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); textdomain(PACKAGE_NAME); /* set up signal handler */ sigemptyset (&sigset); action.sa_handler = signal_handler; action.sa_mask = sigset; action.sa_flags = SA_NOCLDSTOP; sigaction (SIGTERM, &action, (struct sigaction *) NULL); sigaction (SIGINT, &action, (struct sigaction *) NULL); sigaction (SIGHUP, &action, (struct sigaction *) NULL); g_type_init (); gnome_vfs_init (); #ifdef USE_GCONF gconf = gconf_client_get_default (); gconf_client_add_dir (gconf, QUARK_GCONF_ROOT, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); gconf_client_notify_add (gconf, QUARK_GCONF_ROOT, config_changed, NULL, NULL, NULL); #endif /* make the directory we use in ~ */ dir = g_build_filename (g_get_home_dir(), ".quark", NULL); mkdir (dir, S_IRWXU|S_IRWXG|S_IRWXO); g_free (dir); loop = g_main_loop_new (NULL, FALSE); if (!fifo_open ()) { g_critical("failed to open fifo"); return 1; } music_init (); g_static_mutex_lock (&main_mutex); playlist_init (); #ifdef USE_GCONF config_load (gconf); #endif main_status = QUARK_RUNNING; g_static_mutex_unlock (&main_mutex); g_main_loop_run (loop); g_static_mutex_lock (&main_mutex); main_status = QUARK_EXITING; #ifdef USE_GCONF config_save (gconf); #endif playlist_destroy (); g_static_mutex_unlock (&main_mutex); music_destroy (); fifo_destroy (); g_main_loop_unref (loop); #ifdef USE_GCONF g_object_unref (G_OBJECT (gconf)); #endif gnome_vfs_shutdown (); return 0; }
osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activated) { /* Create needed variables */ GtkWidget *dialog; GtkObject *adj[NUM_BANDS]; struct label_band *lband[NUM_BANDS]; struct dialog_and_sliders *dialog_slid; GtkWidget *slider_band[NUM_BANDS]; GtkWidget *single_slider_container[NUM_BANDS]; gulong update_label_signal[NUM_BANDS]; gulong update_band_signal[NUM_BANDS]; GtkWidget *sliders_container; gint i; GtkWidget *toolbar; GtkToolItem *toolitem_open; GtkToolItem *toolitem_save_as; GtkToolItem *toolitem_delete; GtkWidget *content_area; guint update_slider_signal; dialog = gtk_dialog_new(); gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(data)); gtk_window_set_title(GTK_WINDOW(dialog), "MAFW Equalizer"); gtk_window_set_default_size(GTK_WINDOW(dialog), -1, 400); sliders_container = gtk_hbox_new(TRUE, 10); toolbar = gtk_toolbar_new(); /* Create the bands */ for (i = 0; i < NUM_BANDS; i++) { slider_band[i] = hildon_gtk_vscale_new(); adj[i] = gtk_adjustment_new(EQ_GAIN_MIN, EQ_GAIN_MIN, EQ_GAIN_MAX, 1, 10, 0); gtk_range_set_adjustment(GTK_RANGE(slider_band[i]), GTK_ADJUSTMENT(adj[i])); gtk_range_set_inverted(GTK_RANGE(slider_band[i]), TRUE); gtk_range_set_update_policy(GTK_RANGE(slider_band[i]), GTK_UPDATE_DELAYED); gtk_range_set_show_fill_level(GTK_RANGE(slider_band[i]), FALSE); single_slider_container[i] = gtk_hbox_new(TRUE, 0); lband[i] = g_new0(struct label_band, 1); lband[i]->label = gtk_label_new(NULL); lband[i]->id = i; gtk_label_set_angle(GTK_LABEL(lband[i]->label), 90); gtk_misc_set_alignment(GTK_MISC(lband[i]->label), 0, 0.9); gtk_box_pack_start(GTK_BOX(single_slider_container[i]), lband[i]->label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(single_slider_container[i]), slider_band[i], TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(sliders_container), single_slider_container[i], TRUE, TRUE, 10); update_label_signal[i] = g_signal_connect(slider_band[i], "value-changed", G_CALLBACK(update_label_cb), lband[i]); gtk_range_set_value(GTK_RANGE(slider_band[i]), get_band_value(i)); update_band_signal[i] = g_signal_connect(slider_band[i], "value-changed", G_CALLBACK(update_band_cb), GINT_TO_POINTER(i)); } /* Listen for changes in gconf */ if (!confclient) { confclient = gconf_client_get_default(); } gconf_client_add_dir(confclient, GCONF_MAFW_GST_EQ_RENDERER, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); update_slider_signal = gconf_client_notify_add( confclient, GCONF_MAFW_GST_EQ_RENDERER, (GConfClientNotifyFunc) update_slider_cb, slider_band, NULL, NULL); /* Create the toolbuttons */ toolitem_open = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN); toolitem_save_as = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE_AS); toolitem_delete = gtk_tool_button_new_from_stock(GTK_STOCK_DELETE); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem_open, -1); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem_save_as, -1); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem_delete, -1); g_signal_connect(toolitem_open, "clicked", G_CALLBACK(open_button_cb), dialog); g_signal_connect(toolitem_delete, "clicked", G_CALLBACK(delete_button_cb), dialog); dialog_slid = g_new0(struct dialog_and_sliders, 1); dialog_slid->dialog = dialog; dialog_slid->slider_band = slider_band; g_signal_connect(toolitem_save_as, "clicked", G_CALLBACK(save_as_button_cb), dialog_slid); content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); gtk_box_pack_start(GTK_BOX(content_area), sliders_container, TRUE, TRUE, 1); gtk_box_pack_start(GTK_BOX(content_area), toolbar, FALSE, FALSE, 1); /* Run the dialog */ gtk_widget_show_all(GTK_WIDGET(dialog)); gtk_dialog_run(GTK_DIALOG(dialog)); /* Free everything */ gconf_client_notify_remove(confclient, update_slider_signal); for (i = 0; i < NUM_BANDS; i++) { g_signal_handler_disconnect(slider_band[i], update_label_signal[i]); g_signal_handler_disconnect(slider_band[i], update_band_signal[i]); g_free(lband[i]); } g_free(dialog_slid); gtk_widget_destroy(GTK_WIDGET(dialog)); return OSSO_OK; }
static GObject * mud_connections_constructor (GType gtype, guint n_properties, GObjectConstructParam *properties) { MudConnections *conn; GladeXML *glade; GConfClient *client; GtkWidget *main_window; GObject *obj; MudConnectionsClass *klass; GObjectClass *parent_class; /* Chain up to parent constructor */ klass = MUD_CONNECTIONS_CLASS( g_type_class_peek(MUD_TYPE_CONNECTIONS) ); parent_class = G_OBJECT_CLASS( g_type_class_peek_parent(klass) ); obj = parent_class->constructor(gtype, n_properties, properties); conn = MUD_CONNECTIONS(obj); if(!conn->parent_window) g_error("Tried to instantiate MudConnections without passing parent MudWindow\n"); g_object_get(conn->parent_window, "window", &conn->priv->winwidget, "tray", &conn->priv->tray, NULL); glade = glade_xml_new(GLADEDIR "/muds.glade", "mudviewwindow", NULL); conn->priv->window = glade_xml_get_widget(glade, "mudviewwindow"); conn->priv->iconview = glade_xml_get_widget(glade, "iconview"); conn->priv->qconnect_host_entry = glade_xml_get_widget(glade, "qconnect_host_entry"); conn->priv->qconnect_port_entry = glade_xml_get_widget(glade, "qconnect_port_entry"); conn->priv->qconnect_connect_button = glade_xml_get_widget(glade, "qconnect_connect_button"); conn->priv->icon_model = GTK_TREE_MODEL(gtk_list_store_new(MODEL_COLUMN_N, G_TYPE_STRING, GDK_TYPE_PIXBUF)); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(conn->priv->icon_model), MODEL_COLUMN_STRING, GTK_SORT_ASCENDING); gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(conn->priv->icon_model), MODEL_COLUMN_STRING, mud_connections_compare_func, NULL, NULL); conn->priv->original_name = NULL; conn->priv->original_char_name = NULL; gtk_icon_view_set_model(GTK_ICON_VIEW(conn->priv->iconview), conn->priv->icon_model); g_object_unref(conn->priv->icon_model); gtk_icon_view_set_text_column(GTK_ICON_VIEW(conn->priv->iconview), MODEL_COLUMN_STRING); gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(conn->priv->iconview), MODEL_COLUMN_PIXBUF); client = gconf_client_get_default(); gconf_client_add_dir(client, "/apps/gnome-mud/muds", GCONF_CLIENT_PRELOAD_NONE, NULL); conn->priv->connection = gconf_client_notify_add(client, "/apps/gnome-mud/muds", (GConfClientNotifyFunc) mud_connections_gconf_notify_cb, conn, NULL, NULL); g_signal_connect(conn->priv->iconview, "item-activated", G_CALLBACK(mud_connections_iconview_activate_cb), conn); g_signal_connect(conn->priv->iconview, "button-press-event", G_CALLBACK(mud_connections_button_press_cb), conn); g_signal_connect(conn->priv->window, "destroy", G_CALLBACK(mud_connections_close_cb), conn); g_signal_connect(glade_xml_get_widget(glade, "connect_button"), "clicked", G_CALLBACK(mud_connections_connect_cb), conn); g_signal_connect(glade_xml_get_widget(glade, "add_button"), "clicked", G_CALLBACK(mud_connections_add_cb), conn); g_signal_connect(glade_xml_get_widget(glade, "delete_button"), "clicked", G_CALLBACK(mud_connections_delete_cb), conn); g_signal_connect(glade_xml_get_widget(glade, "properties_button"), "clicked", G_CALLBACK(mud_connections_properties_cb), conn); g_signal_connect(conn->priv->qconnect_connect_button, "clicked", G_CALLBACK(mud_connections_qconnect_cb), conn); mud_connections_populate_iconview(conn); g_object_get(conn->parent_window, "window", &main_window, NULL); g_object_set(conn->priv->window, "transient-for", GTK_WINDOW(main_window), NULL); gtk_widget_show_all(conn->priv->window); g_object_unref(glade); g_object_unref(client); return obj; }
void font_init (AppearanceData *data) { GObject *peditor; GtkWidget *widget; data->font_details = NULL; data->font_groups = NULL; gconf_client_add_dir (data->client, "/desktop/gnome/interface", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (data->client, "/apps/nautilus/preferences", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (data->client, METACITY_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); #ifdef HAVE_XFT2 gconf_client_add_dir (data->client, FONT_RENDER_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); #endif /* HAVE_XFT2 */ widget = glade_xml_get_widget (data->xml, "application_font"); peditor = gconf_peditor_new_font (NULL, GTK_FONT_KEY, widget, "conv-from-widget-cb", application_font_to_gconf, NULL); g_signal_connect_swapped (peditor, "value-changed", G_CALLBACK (application_font_changed), widget); application_font_changed (widget); peditor = gconf_peditor_new_font (NULL, DOCUMENT_FONT_KEY, glade_xml_get_widget (data->xml, "document_font"), NULL); peditor = gconf_peditor_new_font (NULL, DESKTOP_FONT_KEY, glade_xml_get_widget (data->xml, "desktop_font"), NULL); peditor = gconf_peditor_new_font (NULL, WINDOW_TITLE_FONT_KEY, glade_xml_get_widget (data->xml, "window_title_font"), NULL); peditor = gconf_peditor_new_font (NULL, MONOSPACE_FONT_KEY, glade_xml_get_widget (data->xml, "monospace_font"), NULL); gconf_client_notify_add (data->client, WINDOW_TITLE_USES_SYSTEM_KEY, metacity_changed, data, NULL, NULL); metacity_titlebar_load_sensitivity (data); #ifdef HAVE_XFT2 setup_font_pair (glade_xml_get_widget (data->xml, "monochrome_radio"), glade_xml_get_widget (data->xml, "monochrome_sample"), ANTIALIAS_NONE, HINT_FULL); setup_font_pair (glade_xml_get_widget (data->xml, "best_shapes_radio"), glade_xml_get_widget (data->xml, "best_shapes_sample"), ANTIALIAS_GRAYSCALE, HINT_MEDIUM); setup_font_pair (glade_xml_get_widget (data->xml, "best_contrast_radio"), glade_xml_get_widget (data->xml, "best_contrast_sample"), ANTIALIAS_GRAYSCALE, HINT_FULL); setup_font_pair (glade_xml_get_widget (data->xml, "subpixel_radio"), glade_xml_get_widget (data->xml, "subpixel_sample"), ANTIALIAS_RGBA, HINT_FULL); font_render_load (data->client); gconf_client_notify_add (data->client, FONT_RENDER_DIR, font_render_changed, data->client, NULL, NULL); g_signal_connect (glade_xml_get_widget (data->xml, "details_button"), "clicked", G_CALLBACK (cb_show_details), data); #else /* !HAVE_XFT2 */ gtk_widget_hide (glade_xml_get_widget (data->xml, "font_render_frame")); #endif /* HAVE_XFT2 */ }
static void penge_everything_pane_init (PengeEverythingPane *self) { PengeEverythingPanePrivate *priv = GET_PRIVATE_REAL (self); gfloat tile_width, tile_height; GError *error = NULL; self->priv = priv; /* pointer to pointer */ priv->pointer_to_actor = g_hash_table_new (NULL, NULL); /* For storing sw items */ priv->uuid_to_sw_items = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)sw_item_unref); priv->client = sw_client_new (); sw_client_get_services (priv->client, (SwClientGetServicesCallback)_client_get_services_cb, self); priv->recent_log = g_object_new (ZEITGEIST_TYPE_LOG, NULL); priv->recent_monitor = zeitgeist_monitor_new ( zeitgeist_time_range_new_anytime (), _default_template_factory ()); g_signal_connect (priv->recent_monitor, "events-inserted", (GCallback)_zeitgeist_monitor_events_inserted_signal, self); g_signal_connect (priv->recent_monitor, "events-deleted", (GCallback)_zeitgeist_monitor_events_deleted_signal, self); /* the log holds a weak ref to the monitor */ zeitgeist_log_install_monitor (priv->recent_log, priv->recent_monitor); penge_block_container_set_spacing (PENGE_BLOCK_CONTAINER (self), 5); priv->gconf_client = gconf_client_get_default (); tile_width = gconf_client_get_float (priv->gconf_client, DAWATI_MYZONE_MIN_TILE_WIDTH, NULL); /* Returns 0.0 if unset */ if (tile_width == 0.0) { tile_width = TILE_WIDTH; } tile_height = gconf_client_get_float (priv->gconf_client, DAWATI_MYZONE_MIN_TILE_HEIGHT, NULL); if (tile_height == 0.0) { tile_height = TILE_HEIGHT; } penge_block_container_set_min_tile_size (PENGE_BLOCK_CONTAINER (self), tile_width, tile_height); g_signal_connect (self, "count-changed", (GCallback)_layout_count_changed_cb, self); priv->ratio_notify_id = gconf_client_notify_add (priv->gconf_client, DAWATI_MYZONE_RATIO, _gconf_ratio_notify_cb, self, NULL, &error); if (error) { g_warning (G_STRLOC ": Error setting gconf key notification: %s", error->message); g_clear_error (&error); } else { gconf_client_notify (priv->gconf_client, DAWATI_MYZONE_RATIO); } priv->refresh_id = g_timeout_add_seconds (REFRESH_TIME, (GSourceFunc) _refresh_cb, self); }
static void mc_setup_listeners (MCData *mc) { GConfClient *client; char *key; int i = 0; client = gconf_client_get_default (); gconf_client_add_dir (client, "/apps/mini-commander", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "show_default_theme"); mc->listeners [i++] = gconf_client_notify_add ( client, key, (GConfClientNotifyFunc) show_default_theme_changed, mc, NULL, NULL); g_free (key); key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "autocomplete_history"); mc->listeners [i++] = gconf_client_notify_add ( client, key, (GConfClientNotifyFunc) auto_complete_history_changed, mc, NULL, NULL); g_free (key); key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "normal_size_x"); mc->listeners [i++] = gconf_client_notify_add ( client, key, (GConfClientNotifyFunc) normal_size_x_changed, mc, NULL, NULL); g_free (key); key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "normal_size_y"); mc->listeners [i++] = gconf_client_notify_add ( client, key, (GConfClientNotifyFunc) normal_size_y_changed, mc, NULL, NULL); g_free (key); key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_fg_r"); mc->listeners [i++] = gconf_client_notify_add ( client, key, (GConfClientNotifyFunc) cmd_line_color_fg_r_changed, mc, NULL, NULL); g_free (key); key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_fg_g"); mc->listeners [i++] = gconf_client_notify_add ( client, key, (GConfClientNotifyFunc) cmd_line_color_fg_g_changed, mc, NULL, NULL); g_free (key); key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_fg_b"); mc->listeners [i++] = gconf_client_notify_add ( client, key, (GConfClientNotifyFunc) cmd_line_color_fg_b_changed, mc, NULL, NULL); g_free (key); key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_bg_r"); mc->listeners [i++] = gconf_client_notify_add ( client, key, (GConfClientNotifyFunc) cmd_line_color_bg_r_changed, mc, NULL, NULL); g_free (key); key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_bg_g"); mc->listeners [i++] = gconf_client_notify_add ( client, key, (GConfClientNotifyFunc) cmd_line_color_bg_g_changed, mc, NULL, NULL); g_free (key); key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_bg_b"); mc->listeners [i++] = gconf_client_notify_add ( client, key, (GConfClientNotifyFunc) cmd_line_color_bg_b_changed, mc, NULL, NULL); g_free (key); mc->listeners [i++] = gconf_client_notify_add ( client, "/apps/mini-commander/macro_patterns", (GConfClientNotifyFunc) macros_changed, mc, NULL, NULL); mc->listeners [i++] = gconf_client_notify_add ( client, "/apps/mini-commander/macro_commands", (GConfClientNotifyFunc) macros_changed, mc, NULL, NULL); g_assert (i == MC_NUM_LISTENERS); g_object_unref (client); }
static void gdict_pref_dialog_init (GdictPrefDialog *dialog) { gchar *font; GError *error = NULL; gtk_window_set_default_size (GTK_WINDOW (dialog), DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2); gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); /* add buttons */ gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-help", GTK_RESPONSE_HELP); gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-close", GTK_RESPONSE_ACCEPT); dialog->gconf_client = gconf_client_get_default (); gconf_client_add_dir (dialog->gconf_client, GDICT_GCONF_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); dialog->notify_id = gconf_client_notify_add (dialog->gconf_client, GDICT_GCONF_DIR, gdict_pref_dialog_gconf_notify_cb, dialog, NULL, NULL); /* get the UI from the GtkBuilder file */ dialog->builder = gtk_builder_new (); gtk_builder_add_from_file (dialog->builder, GDICT_PREFERENCES_UI, &error); if (error) { g_critical ("Unable to load the preferences user interface: %s", error->message); g_error_free (error); g_assert_not_reached (); } /* the main widget */ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), GTK_WIDGET (gtk_builder_get_object (dialog->builder, "preferences_root"))); /* keep all the interesting widgets around */ dialog->notebook = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "preferences_notebook")); dialog->sources_view = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "sources_treeview")); build_sources_view (dialog); dialog->active_source = gdict_gconf_get_string_with_default (dialog->gconf_client, GDICT_GCONF_SOURCE_KEY, GDICT_DEFAULT_SOURCE_NAME); dialog->sources_add = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "add_button")); gtk_widget_set_tooltip_text (dialog->sources_add, _("Add a new dictionary source")); g_signal_connect (dialog->sources_add, "clicked", G_CALLBACK (source_add_clicked_cb), dialog); dialog->sources_remove = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "remove_button")); gtk_widget_set_tooltip_text (dialog->sources_remove, _("Remove the currently selected dictionary source")); g_signal_connect (dialog->sources_remove, "clicked", G_CALLBACK (source_remove_clicked_cb), dialog); font = gconf_client_get_string (dialog->gconf_client, GDICT_GCONF_PRINT_FONT_KEY, NULL); if (!font) font = g_strdup (GDICT_DEFAULT_PRINT_FONT); dialog->font_button = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "print_font_button")); gtk_font_button_set_font_name (GTK_FONT_BUTTON (dialog->font_button), font); gtk_widget_set_tooltip_text (dialog->font_button, _("Set the font used for printing the definitions")); g_signal_connect (dialog->font_button, "font-set", G_CALLBACK (font_button_font_set_cb), dialog); g_free (font); gtk_widget_show_all (dialog->notebook); /* we want to intercept the response signal before any other * callbacks might be attached by the users of the * GdictPrefDialog widget. */ g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL); }
DrWright * drwright_new (void) { DrWright *dr; GtkWidget *item; GConfClient *client; dr = g_new0 (DrWright, 1); client = gconf_client_get_default (); gconf_client_add_dir (client, GCONF_PATH, GCONF_CLIENT_PRELOAD_NONE, NULL); gconf_client_notify_add (client, GCONF_PATH, gconf_notify_cb, dr, NULL, NULL); dr->type_time = 60 * gconf_client_get_int ( client, GCONF_PATH "/type_time", NULL); dr->warn_time = MIN (dr->type_time / 12, 60*3); dr->break_time = 60 * gconf_client_get_int ( client, GCONF_PATH "/break_time", NULL); dr->enabled = gconf_client_get_bool ( client, GCONF_PATH "/enabled", NULL); g_object_unref (client); if (debug) { setup_debug_values (dr); } dr->popup_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<main>", NULL); gtk_item_factory_set_translate_func (dr->popup_factory, item_factory_trans_cb, NULL, NULL); gtk_item_factory_create_items (dr->popup_factory, G_N_ELEMENTS (popup_items), popup_items, dr); /*item = gtk_item_factory_get_widget_by_action (dr->popup_factory, POPUP_ITEM_ENABLED); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), dr->enabled);*/ item = gtk_item_factory_get_widget_by_action (dr->popup_factory, POPUP_ITEM_BREAK); gtk_widget_set_sensitive (item, dr->enabled); dr->timer = g_timer_new (); dr->idle_timer = g_timer_new (); dr->state = STATE_START; dr->monitor = drw_monitor_new (); g_signal_connect (dr->monitor, "activity", G_CALLBACK (activity_detected_cb), dr); dr->neutral_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar.png", NULL); dr->red_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-red.png", NULL); dr->green_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-green.png", NULL); dr->disabled_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-disabled.png", NULL); init_tray_icon (dr); g_timeout_add_seconds (12, (GSourceFunc) update_tooltip, dr); g_timeout_add_seconds (1, (GSourceFunc) maybe_change_state, dr); return dr; }
/* Returns: TRUE if the notifier was created, FALSE if it was already existing. */ static gboolean gconf_settings_backend_add_notifier (GConfSettingsBackend *gconf, const gchar *path) { GConfSettingsBackendNotifier *n_or_p; GConfSettingsBackendNotifier *notifier; GSList *siblings; GSList *l; n_or_p = gconf_settings_backend_find_notifier_or_parent (gconf, path); if (n_or_p && g_str_equal (path, n_or_p->path)) { n_or_p->refcount += 1; return FALSE; } notifier = g_slice_new0 (GConfSettingsBackendNotifier); notifier->parent = n_or_p; notifier->path = g_strdup (path); notifier->refcount = 1; if (notifier->parent == NULL) notifier->notify_id = gconf_client_notify_add (gconf->priv->client, path, (GConfClientNotifyFunc) gconf_settings_backend_notified, gconf, NULL, NULL); else notifier->notify_id = 0; /* Move notifiers living at the same level but that are subpaths below this * new notifier, removing their notify handler if necessary. */ if (notifier->parent) siblings = notifier->parent->subpaths; else siblings = gconf->priv->notifiers; l = siblings; while (l != NULL) { GConfSettingsBackendNotifier *sibling; GSList *next; sibling = l->data; next = l->next; if (g_str_has_prefix (sibling->path, notifier->path)) { if (sibling->notify_id) { gconf_client_notify_remove (gconf->priv->client, sibling->notify_id); sibling->notify_id = 0; } siblings = g_slist_remove_link (siblings, l); l->next = notifier->subpaths; notifier->subpaths = l; } l = next; } siblings = g_slist_prepend (siblings, notifier); if (notifier->parent) notifier->parent->subpaths = siblings; else gconf->priv->notifiers = siblings; return TRUE; }
/** * gpm_backlight_init: * @brightness: This brightness class instance * * initialises the brightness class. NOTE: We expect laptop_panel objects * to *NOT* be removed or added during the session. * We only control the first laptop_panel object if there are more than one. **/ static void gpm_backlight_init (GpmBacklight *backlight) { gboolean lid_is_present = TRUE; GpmPrefsServer *prefs_server; backlight->priv = GPM_BACKLIGHT_GET_PRIVATE (backlight); /* record our idle time */ backlight->priv->idle_timer = g_timer_new (); /* watch for manual brightness changes (for the popup widget) */ backlight->priv->brightness = gpm_brightness_new (); g_signal_connect (backlight->priv->brightness, "brightness-changed", G_CALLBACK (brightness_changed_cb), backlight); /* we use up_client for the ac-adapter-changed signal */ backlight->priv->client = up_client_new (); g_signal_connect (backlight->priv->client, "changed", G_CALLBACK (gpm_backlight_client_changed_cb), backlight); /* gets caps */ backlight->priv->can_dim = gpm_brightness_has_hw (backlight->priv->brightness); /* we use DeviceKit-power to see if we should show the lid UI */ g_object_get (backlight->priv->client, "lid-is-present", &lid_is_present, NULL); /* expose ui in prefs program */ prefs_server = gpm_prefs_server_new (); if (lid_is_present) gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_LID); if (backlight->priv->can_dim) gpm_prefs_server_set_capability (prefs_server, GPM_PREFS_SERVER_BACKLIGHT); g_object_unref (prefs_server); /* watch for dim value changes */ backlight->priv->conf = gconf_client_get_default (); /* watch gnome-power-manager keys */ gconf_client_add_dir (backlight->priv->conf, GPM_CONF_DIR, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); gconf_client_notify_add (backlight->priv->conf, GPM_CONF_DIR, (GConfClientNotifyFunc) gpm_conf_gconf_key_changed_cb, backlight, NULL, NULL); /* set the main brightness, this is designed to be updated if the user changes the * brightness so we can undim to the 'correct' value */ backlight->priv->master_percentage = gconf_client_get_int (backlight->priv->conf, GPM_CONF_BACKLIGHT_BRIGHTNESS_AC, NULL); /* watch for brightness up and down buttons and also check lid state */ backlight->priv->button = gpm_button_new (); g_signal_connect (backlight->priv->button, "button-pressed", G_CALLBACK (gpm_backlight_button_pressed_cb), backlight); /* watch for idle mode changes */ backlight->priv->idle = gpm_idle_new (); g_signal_connect (backlight->priv->idle, "idle-changed", G_CALLBACK (idle_changed_cb), backlight); /* assumption */ backlight->priv->system_is_idle = FALSE; backlight->priv->idle_dim_timeout = gconf_client_get_int (backlight->priv->conf, GPM_CONF_BACKLIGHT_IDLE_DIM_TIME, NULL); gpm_idle_set_timeout_dim (backlight->priv->idle, backlight->priv->idle_dim_timeout); /* use a visual widget */ backlight->priv->popup = gsd_media_keys_window_new (); gsd_media_keys_window_set_action_custom (GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup), "gpm-brightness-lcd", TRUE); gtk_window_set_position (GTK_WINDOW (backlight->priv->popup), GTK_WIN_POS_NONE); /* DPMS mode poll class */ backlight->priv->dpms = gpm_dpms_new (); /* we refresh DPMS on resume */ backlight->priv->control = gpm_control_new (); g_signal_connect (backlight->priv->control, "resume", G_CALLBACK (control_resume_cb), backlight); /* Don't do dimming on inactive console */ backlight->priv->consolekit = egg_console_kit_new (); /* sync at startup */ gpm_backlight_brightness_evaluate_and_set (backlight, FALSE); }
void create_main_window (ContactsData *data) { GtkWidget *main_window; GtkWidget *vbox7; GtkWidget *main_menubar; GtkWidget *contacts_menu; GtkWidget *contacts_menu_menu; GtkWidget *new_menuitem; GtkWidget *edit_menuitem; GtkWidget *delete_menuitem; GtkWidget *contacts_import; GtkWidget *contacts_quit; GtkWidget *contact_menu; GtkWidget *contact_menu_menu; GtkWidget *contact_delete; GtkWidget *edit_groups; GtkWidget *contact_export; GtkWidget *contact_quit; GtkWidget *edit_menu; GtkWidget *menuitem5_menu; GtkWidget *cut; GtkWidget *copy; GtkWidget *paste; GtkWidget *help_menu; GtkWidget *menuitem7_menu; GtkWidget *about1; GtkWidget *main_notebook; GtkWidget *main_hpane; GtkWidget *contacts_vbox; GtkWidget *scrolledwindow2; GtkWidget *contacts_treeview; GtkWidget *search_hbox; GtkWidget *search_entry_hbox; GtkWidget *search_entry; GtkWidget *search_tab_hbox; GtkWidget *symbols_radiobutton; GSList *symbols_radiobutton_group = NULL; GtkWidget *atog_radiobutton; GtkWidget *hton_radiobutton; GtkWidget *otou_radiobutton; GtkWidget *vtoz_radiobutton; GtkWidget *vbox3; GtkWidget *summary_vbox; GtkWidget *preview_header_hbox; GtkWidget *preview_namegroup_vbox; GtkWidget *summary_name_label; GtkWidget *summary_group_label; GtkWidget *photo_image; GtkWidget *scrolledwindow3; GtkWidget *viewport1; GtkWidget *summary_table; GtkWidget *summary_hbuttonbox; GtkWidget *new_button; GtkWidget *edit_button; GtkWidget *delete_button; GtkWidget *vbox4; GtkWidget *scrolledwindow4; GtkWidget *viewport2; GtkWidget *edit_table; GtkWidget *hbuttonbox2; GtkWidget *add_field_button; GtkWidget *remove_field_button; GtkWidget *edit_done_button; GtkWidget *widget; GtkAccelGroup *accel_group; ContactsUI *ui = data->ui; GtkSizeGroup *size_group; #ifdef HAVE_GCONF GConfClient *client; gchar *search; gint width, height; #endif accel_group = gtk_accel_group_new (); main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (main_window), _("Contacts")); gtk_window_set_icon_name (GTK_WINDOW (main_window), "contacts"); gtk_window_set_default_size (GTK_WINDOW (main_window), 320, 240); vbox7 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (main_window), vbox7); main_menubar = gtk_menu_bar_new (); gtk_box_pack_start (GTK_BOX (vbox7), main_menubar, FALSE, FALSE, 0); contacts_menu = gtk_menu_item_new_with_mnemonic (_("C_ontacts")); gtk_container_add (GTK_CONTAINER (main_menubar), contacts_menu); contacts_menu_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (contacts_menu), contacts_menu_menu); new_menuitem = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group); gtk_container_add (GTK_CONTAINER (contacts_menu_menu), new_menuitem); edit_menuitem = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group); gtk_container_add (GTK_CONTAINER (contacts_menu_menu), edit_menuitem); gtk_widget_set_sensitive (edit_menuitem, FALSE); delete_menuitem = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group); gtk_container_add (GTK_CONTAINER (contacts_menu_menu), delete_menuitem); gtk_widget_set_sensitive (delete_menuitem, FALSE); contacts_import = gtk_menu_item_new_with_mnemonic (_("_Import...")); gtk_container_add (GTK_CONTAINER (contacts_menu_menu), contacts_import); widget = gtk_separator_menu_item_new (); gtk_container_add (GTK_CONTAINER (contacts_menu_menu), widget); gtk_widget_set_sensitive (widget, FALSE); contacts_quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group); gtk_container_add (GTK_CONTAINER (contacts_menu_menu), contacts_quit); contact_menu = gtk_menu_item_new_with_mnemonic (_("C_ontact")); gtk_container_add (GTK_CONTAINER (main_menubar), contact_menu); g_object_set (G_OBJECT (contact_menu), "no-show-all", TRUE, NULL); contact_menu_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (contact_menu), contact_menu_menu); contact_delete = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group); gtk_container_add (GTK_CONTAINER (contact_menu_menu), contact_delete); edit_groups = gtk_menu_item_new_with_mnemonic (_("_Groups")); gtk_container_add (GTK_CONTAINER (contact_menu_menu), edit_groups); contact_export = gtk_menu_item_new_with_mnemonic (_("_Export")); gtk_container_add (GTK_CONTAINER (contact_menu_menu), contact_export); widget = gtk_separator_menu_item_new (); gtk_container_add (GTK_CONTAINER (contact_menu_menu), widget); gtk_widget_set_sensitive (widget, FALSE); contact_quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group); gtk_container_add (GTK_CONTAINER (contact_menu_menu), contact_quit); edit_menu = gtk_menu_item_new_with_mnemonic (_("Ed_it")); gtk_container_add (GTK_CONTAINER (main_menubar), edit_menu); menuitem5_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (edit_menu), menuitem5_menu); cut = gtk_image_menu_item_new_from_stock ("gtk-cut", accel_group); gtk_container_add (GTK_CONTAINER (menuitem5_menu), cut); copy = gtk_image_menu_item_new_from_stock ("gtk-copy", accel_group); gtk_container_add (GTK_CONTAINER (menuitem5_menu), copy); paste = gtk_image_menu_item_new_from_stock ("gtk-paste", accel_group); gtk_container_add (GTK_CONTAINER (menuitem5_menu), paste); help_menu = gtk_menu_item_new_with_mnemonic (_("_Help")); gtk_container_add (GTK_CONTAINER (main_menubar), help_menu); menuitem7_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (help_menu), menuitem7_menu); about1 = gtk_image_menu_item_new_from_stock ("gtk-about", accel_group); gtk_container_add (GTK_CONTAINER (menuitem7_menu), about1); main_notebook = gtk_notebook_new (); gtk_box_pack_start (GTK_BOX (vbox7), main_notebook, TRUE, TRUE, 0); GTK_WIDGET_UNSET_FLAGS (main_notebook, GTK_CAN_FOCUS); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (main_notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (main_notebook), FALSE); main_hpane = gtk_hpaned_new (); gtk_container_add (GTK_CONTAINER (main_notebook), main_hpane); contacts_vbox = gtk_vbox_new (FALSE, 6); gtk_paned_pack1 (GTK_PANED (main_hpane), contacts_vbox, FALSE, FALSE); gtk_container_set_border_width (GTK_CONTAINER (contacts_vbox), 6); groups_combobox = gtk_combo_box_new (); GtkListStore *ls = gtk_list_store_new (1, G_TYPE_STRING); GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (groups_combobox), groups_combo_seperator_func, NULL, NULL); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (groups_combobox), renderer, TRUE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (groups_combobox), renderer, "text", 0); gtk_combo_box_set_model (GTK_COMBO_BOX (groups_combobox), GTK_TREE_MODEL(ls)); gtk_box_pack_start (GTK_BOX (contacts_vbox), groups_combobox, FALSE, TRUE, 0); gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (groups_combobox), FALSE); scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); gtk_box_pack_start (GTK_BOX (contacts_vbox), scrolledwindow2, TRUE, TRUE, 0); GTK_WIDGET_UNSET_FLAGS (scrolledwindow2, GTK_CAN_FOCUS); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN); contacts_treeview = gtk_tree_view_new (); gtk_container_add (GTK_CONTAINER (scrolledwindow2), contacts_treeview); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (contacts_treeview), FALSE); gtk_tree_view_set_enable_search (GTK_TREE_VIEW (contacts_treeview), FALSE); search_hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_end (GTK_BOX (contacts_vbox), search_hbox, FALSE, TRUE, 0); search_entry_hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (search_hbox), search_entry_hbox, TRUE, TRUE, 0); search_entry = gtk_entry_new (); gtk_box_pack_end (GTK_BOX (search_entry_hbox), search_entry, TRUE, TRUE, 0); gtk_entry_set_activates_default (GTK_ENTRY (search_entry), TRUE); widget = gtk_label_new_with_mnemonic (_("_Search:")); gtk_box_pack_start (GTK_BOX (search_entry_hbox), widget, FALSE, FALSE, 0); gtk_misc_set_padding (GTK_MISC (widget), 6, 0); gtk_label_set_mnemonic_widget (GTK_LABEL (widget), search_entry); search_tab_hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (search_hbox), search_tab_hbox, TRUE, TRUE, 0); g_object_set (G_OBJECT (search_tab_hbox), "no-show-all", TRUE, NULL); symbols_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("0-9#")); gtk_box_pack_start (GTK_BOX (search_tab_hbox), symbols_radiobutton, TRUE, FALSE, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (symbols_radiobutton), symbols_radiobutton_group); symbols_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (symbols_radiobutton)); atog_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("A-G")); gtk_box_pack_start (GTK_BOX (search_tab_hbox), atog_radiobutton, TRUE, FALSE, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (atog_radiobutton), symbols_radiobutton_group); symbols_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (atog_radiobutton)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (atog_radiobutton), TRUE); hton_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("H-N")); gtk_box_pack_start (GTK_BOX (search_tab_hbox), hton_radiobutton, TRUE, FALSE, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (hton_radiobutton), symbols_radiobutton_group); symbols_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (hton_radiobutton)); otou_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("O-U")); gtk_box_pack_start (GTK_BOX (search_tab_hbox), otou_radiobutton, TRUE, FALSE, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (otou_radiobutton), symbols_radiobutton_group); symbols_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (otou_radiobutton)); vtoz_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("V-Z")); gtk_box_pack_start (GTK_BOX (search_tab_hbox), vtoz_radiobutton, TRUE, FALSE, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (vtoz_radiobutton), symbols_radiobutton_group); symbols_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (vtoz_radiobutton)); vbox3 = gtk_vbox_new (FALSE, 6); gtk_paned_pack2 (GTK_PANED (main_hpane), vbox3, TRUE, FALSE); gtk_container_set_border_width (GTK_CONTAINER (vbox3), 6); summary_vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox3), summary_vbox, TRUE, TRUE, 0); preview_header_hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (summary_vbox), preview_header_hbox, FALSE, TRUE, 0); preview_namegroup_vbox = gtk_vbox_new (FALSE, 0); summary_name_label = gtk_label_new (NULL); gtk_box_pack_start (GTK_BOX (preview_namegroup_vbox), summary_name_label, TRUE, TRUE, 0); GTK_WIDGET_SET_FLAGS (summary_name_label, GTK_CAN_FOCUS); gtk_label_set_use_markup (GTK_LABEL (summary_name_label), TRUE); gtk_label_set_selectable (GTK_LABEL (summary_name_label), TRUE); gtk_misc_set_alignment (GTK_MISC (summary_name_label), 0, 0.5); gtk_misc_set_padding (GTK_MISC (summary_name_label), 6, 0); gtk_label_set_ellipsize (GTK_LABEL (summary_name_label), PANGO_ELLIPSIZE_END); summary_group_label = gtk_label_new (NULL); gtk_box_pack_start (GTK_BOX (preview_namegroup_vbox), summary_group_label, TRUE, TRUE, 0); GTK_WIDGET_SET_FLAGS (summary_group_label, GTK_CAN_FOCUS); gtk_label_set_use_markup (GTK_LABEL (summary_group_label), TRUE); gtk_label_set_selectable (GTK_LABEL (summary_group_label), TRUE); gtk_misc_set_alignment (GTK_MISC (summary_group_label), 0, 0.5); gtk_misc_set_padding (GTK_MISC (summary_group_label), 6, 0); gtk_label_set_ellipsize (GTK_LABEL (summary_group_label), PANGO_ELLIPSIZE_END); gtk_box_pack_start (GTK_BOX (preview_header_hbox), preview_namegroup_vbox, TRUE, TRUE, 0); /* load stock_person as the default icon so the image has the correct * size before a contact is loaded */ photo_image = gtk_image_new_from_icon_name ("stock_person", GTK_ICON_SIZE_DIALOG); gtk_box_pack_end (GTK_BOX (preview_header_hbox), photo_image, FALSE, TRUE, 6); gtk_misc_set_padding (GTK_MISC (photo_image), 1, 0); scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL); gtk_box_pack_start (GTK_BOX (summary_vbox), scrolledwindow3, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); viewport1 = gtk_viewport_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scrolledwindow3), viewport1); summary_table = gtk_table_new (1, 2, FALSE); gtk_container_add (GTK_CONTAINER (viewport1), summary_table); gtk_table_set_row_spacings (GTK_TABLE (summary_table), 6); gtk_table_set_col_spacings (GTK_TABLE (summary_table), 6); summary_hbuttonbox = gtk_hbutton_box_new (); gtk_box_pack_end (GTK_BOX (vbox3), summary_hbuttonbox, FALSE, FALSE, 0); gtk_button_box_set_layout (GTK_BUTTON_BOX (summary_hbuttonbox), GTK_BUTTONBOX_END); gtk_box_set_spacing (GTK_BOX (summary_hbuttonbox), 6); new_button = gtk_button_new_from_stock ("gtk-new"); gtk_container_add (GTK_CONTAINER (summary_hbuttonbox), new_button); GTK_WIDGET_SET_FLAGS (new_button, GTK_CAN_DEFAULT); edit_button = gtk_button_new_from_stock ("gtk-edit"); gtk_container_add (GTK_CONTAINER (summary_hbuttonbox), edit_button); gtk_widget_set_sensitive (edit_button, FALSE); GTK_WIDGET_SET_FLAGS (edit_button, GTK_CAN_DEFAULT); delete_button = gtk_button_new_from_stock ("gtk-delete"); gtk_container_add (GTK_CONTAINER (summary_hbuttonbox), delete_button); gtk_widget_set_sensitive (delete_button, FALSE); GTK_WIDGET_SET_FLAGS (delete_button, GTK_CAN_DEFAULT); gtk_button_set_focus_on_click (GTK_BUTTON (delete_button), FALSE); vbox4 = gtk_vbox_new (FALSE, 6); gtk_container_add (GTK_CONTAINER (main_notebook), vbox4); gtk_container_set_border_width (GTK_CONTAINER (vbox4), 6); scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL); gtk_box_pack_start (GTK_BOX (vbox4), scrolledwindow4, TRUE, TRUE, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); viewport2 = gtk_viewport_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scrolledwindow4), viewport2); edit_table = gtk_table_new (1, 2, FALSE); gtk_container_add (GTK_CONTAINER (viewport2), edit_table); gtk_container_set_border_width (GTK_CONTAINER (edit_table), 6); gtk_table_set_row_spacings (GTK_TABLE (edit_table), 6); hbuttonbox2 = gtk_hbutton_box_new (); gtk_box_pack_start (GTK_BOX (vbox4), hbuttonbox2, FALSE, TRUE, 0); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox2), GTK_BUTTONBOX_END); gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 6); add_field_button = gtk_button_new_with_mnemonic (_("_Add Field")); gtk_container_add (GTK_CONTAINER (hbuttonbox2), add_field_button); GTK_WIDGET_SET_FLAGS (add_field_button, GTK_CAN_DEFAULT); remove_field_button = gtk_button_new_with_mnemonic (_("_Remove Field")); gtk_container_add (GTK_CONTAINER (hbuttonbox2), remove_field_button); GTK_WIDGET_SET_FLAGS (remove_field_button, GTK_CAN_DEFAULT); gtk_button_set_focus_on_click (GTK_BUTTON (remove_field_button), FALSE); edit_done_button = gtk_button_new_from_stock ("gtk-close"); gtk_container_add (GTK_CONTAINER (hbuttonbox2), edit_done_button); GTK_WIDGET_SET_FLAGS (edit_done_button, GTK_CAN_DEFAULT); gtk_widget_grab_focus (contacts_treeview); gtk_widget_grab_default (edit_button); gtk_window_add_accel_group (GTK_WINDOW (main_window), accel_group); /* Set up size group for bottom row of buttons and search */ size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); gtk_size_group_add_widget (size_group, search_hbox); gtk_size_group_add_widget (size_group, summary_hbuttonbox); g_object_unref (size_group); /* connect signals */ g_signal_connect (G_OBJECT (main_window), "delete-event", G_CALLBACK (contacts_main_window_delete_event_cb), data); g_signal_connect ((gpointer) main_window, "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect_swapped ((gpointer) main_window, "set_focus", G_CALLBACK (contacts_edit_set_focus_cb), GTK_OBJECT (remove_field_button)); g_signal_connect ((gpointer) contacts_quit, "activate", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect ((gpointer) contact_quit, "activate", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect_swapped ((gpointer) cut, "activate", G_CALLBACK (contacts_cut_cb), GTK_OBJECT (main_window)); g_signal_connect_swapped ((gpointer) copy, "activate", G_CALLBACK (contacts_copy_cb), GTK_OBJECT (main_window)); g_signal_connect_swapped ((gpointer) paste, "activate", G_CALLBACK (contacts_paste_cb), GTK_OBJECT (main_window)); g_signal_connect_swapped ((gpointer) about1, "activate", G_CALLBACK (contacts_about_cb), main_window); g_signal_connect_swapped ((gpointer) groups_combobox, "changed", G_CALLBACK (contacts_update_treeview), data); g_signal_connect_data ((gpointer) contacts_treeview, "key_press_event", G_CALLBACK (contacts_treeview_search_cb), GTK_OBJECT (search_entry), NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED); g_signal_connect ((gpointer) search_entry, "changed", G_CALLBACK (contacts_search_changed_cb), data); g_signal_connect ((gpointer) symbols_radiobutton, "clicked", G_CALLBACK (contacts_search_changed_cb), data); g_signal_connect ((gpointer) atog_radiobutton, "clicked", G_CALLBACK (contacts_search_changed_cb), data); g_signal_connect ((gpointer) hton_radiobutton, "clicked", G_CALLBACK (contacts_search_changed_cb), data); g_signal_connect ((gpointer) otou_radiobutton, "clicked", G_CALLBACK (contacts_search_changed_cb), data); g_signal_connect ((gpointer) vtoz_radiobutton, "clicked", G_CALLBACK (contacts_search_changed_cb), data); g_signal_connect ((gpointer) remove_field_button, "clicked", G_CALLBACK (contacts_remove_field_cb), NULL); g_signal_connect (G_OBJECT (new_button), "clicked", G_CALLBACK (contacts_new_cb), data); g_signal_connect (G_OBJECT (new_menuitem), "activate", G_CALLBACK (contacts_new_cb), data); g_signal_connect (G_OBJECT (edit_button), "clicked", G_CALLBACK (contacts_edit_cb), data); g_signal_connect (G_OBJECT (contacts_treeview), "row_activated", G_CALLBACK (contacts_treeview_edit_cb), data); g_signal_connect (G_OBJECT (edit_menuitem), "activate", G_CALLBACK (contacts_edit_cb), data); g_signal_connect (G_OBJECT (delete_button), "clicked", G_CALLBACK (contacts_delete_cb), data); g_signal_connect (G_OBJECT (delete_menuitem), "activate", G_CALLBACK (contacts_delete_cb), data); g_signal_connect (G_OBJECT (contacts_import), "activate", G_CALLBACK (contacts_import_cb), data); g_signal_connect (G_OBJECT (edit_menu), "activate", G_CALLBACK (contacts_edit_menu_activate_cb), data); g_signal_connect (G_OBJECT (groups_combobox), "changed", G_CALLBACK (groups_combobox_changed_cb), data); ui->contact_delete = contact_delete; ui->contact_export = contact_export; ui->contact_menu = contact_menu; ui->contacts_import = contacts_import; ui->contacts_menu = contacts_menu; ui->contacts_treeview = contacts_treeview; ui->new_menuitem = new_menuitem; ui->copy_menuitem = copy; ui->cut_menuitem = cut; ui->delete_menuitem = delete_menuitem; ui->delete_button = delete_button; ui->edit_menuitem = edit_menuitem; ui->edit_button = edit_button; ui->edit_done_button = edit_done_button; ui->edit_groups = edit_groups; ui->edit_menu = edit_menu; ui->edit_table = edit_table; ui->main_menubar = main_menubar; ui->main_notebook = main_notebook; ui->main_window = main_window; ui->new_button = new_button; ui->paste_menuitem = paste; ui->photo_image = photo_image; ui->preview_header_hbox = preview_header_hbox; ui->add_field_button = add_field_button; ui->remove_field_button = remove_field_button; ui->search_entry = search_entry; ui->search_entry_hbox = search_entry_hbox; ui->search_hbox = search_hbox; ui->search_tab_hbox = search_tab_hbox; //ui->groups_combobox = groups_combobox; ui->summary_hbuttonbox = summary_hbuttonbox; ui->summary_name_label = summary_name_label; ui->summary_group_label = summary_group_label; ui->summary_table = summary_table; ui->summary_vbox = summary_vbox; #ifdef HAVE_GCONF client = gconf_client_get_default (); search = gconf_client_get_string (client, GCONF_KEY_SEARCH, NULL); if (!search) { gconf_client_set_string ( client, GCONF_KEY_SEARCH, "entry", NULL); } else { if (strcmp (search, "alphatab") == 0) { gtk_widget_hide (search_entry_hbox); gtk_widget_show (search_tab_hbox); } g_free (search); } gconf_client_add_dir (client, GCONF_PATH, GCONF_CLIENT_PRELOAD_NONE, NULL); gconf_client_notify_add (client, GCONF_KEY_SEARCH, contacts_gconf_search_cb, data, NULL, NULL); width = gconf_client_get_int (client, GCONF_PATH "/width", NULL); height = gconf_client_get_int (client, GCONF_PATH "/height", NULL); gtk_window_set_default_size (GTK_WINDOW (main_window), width, height); #endif }