/** set info */ void ui_info_hardware_set( NiftyconfHardware * hardware) { LedHardware *h = hardware_niftyled(hardware); gtk_link_button_set_uri(GTK_LINK_BUTTON(UI("linkbutton_family")), led_hardware_plugin_get_url(h)); gtk_button_set_label(GTK_BUTTON(UI("linkbutton_family")), led_hardware_plugin_get_family(h)); gtk_label_set_text(GTK_LABEL(UI("label_description")), led_hardware_plugin_get_description(h)); gtk_label_set_text(GTK_LABEL(UI("label_author")), led_hardware_plugin_get_author(h)); gtk_label_set_text(GTK_LABEL(UI("label_license")), led_hardware_plugin_get_license(h)); gchar version[64]; g_snprintf(version, sizeof(version), "v%d.%d.%d", led_hardware_plugin_get_version_major(h), led_hardware_plugin_get_version_minor(h), led_hardware_plugin_get_version_micro(h)); gtk_label_set_text(GTK_LABEL(UI("label_version")), version); }
/** set the widget label */ void XAP_UnixWidget::setLabel(const UT_UTF8String &val) { if (GTK_IS_BUTTON(m_widget)) { gtk_button_set_label(GTK_BUTTON(m_widget), val.utf8_str()); } else if (GTK_IS_LABEL(m_widget)) { if(!gtk_label_get_use_markup(GTK_LABEL(m_widget))) { gtk_label_set_text(GTK_LABEL(m_widget), val.utf8_str()); } else { std::string markup = UT_std_string_sprintf(m_data.c_str(), val.utf8_str()); gtk_label_set_label(GTK_LABEL(m_widget), markup.c_str()); } } else if (GTK_IS_WINDOW(m_widget)) { gtk_window_set_title(GTK_WINDOW(m_widget), val.utf8_str()); } else { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); } }
static void bluetooth_chooser_button_init (BluetoothChooserButton *button) { gtk_button_set_label (GTK_BUTTON (button), _("Click to select device...")); button->image = gtk_image_new (); gtk_button_set_image (GTK_BUTTON (button), button->image); button->bdaddr = NULL; button->dialog = NULL; button->client = bluetooth_client_new (); g_signal_connect (G_OBJECT (button->client), "notify::default-adapter", G_CALLBACK (default_adapter_changed), button); g_signal_connect (G_OBJECT (button->client), "notify::default-adapter-powered", G_CALLBACK (default_adapter_changed), button); /* And set the default value already */ default_adapter_changed (NULL, NULL, button); set_btdevname (button, NULL, NULL, NULL); }
void gui_init(dt_lib_module_t *self) { /* initialize ui widgets */ dt_lib_history_t *d = (dt_lib_history_t *)g_malloc0(sizeof(dt_lib_history_t)); self->data = (void *)d; self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_PIXEL_APPLY_DPI(5)); gtk_widget_set_name(self->widget, "history-ui"); d->history_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); GtkWidget *hhbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, DT_PIXEL_APPLY_DPI(5)); d->compress_button = dtgtk_button_new(NULL, /*CPF_DO_NOT_USE_BORDER | CPF_STYLE_FLAT*/0); gtk_button_set_label(GTK_BUTTON(d->compress_button), _("compress history stack")); gtk_widget_set_tooltip_text(d->compress_button, _("create a minimal history stack which produces the same image")); g_signal_connect(G_OBJECT(d->compress_button), "clicked", G_CALLBACK(_lib_history_compress_clicked_callback), NULL); /* add toolbar button for creating style */ d->create_button = dtgtk_button_new(dtgtk_cairo_paint_styles, CPF_DO_NOT_USE_BORDER); gtk_widget_set_size_request(d->create_button, DT_PIXEL_APPLY_DPI(24), -1); g_signal_connect(G_OBJECT(d->create_button), "clicked", G_CALLBACK(_lib_history_create_style_button_clicked_callback), NULL); gtk_widget_set_tooltip_text(d->create_button, _("create a style from the current history stack")); /* add buttons to buttonbox */ gtk_box_pack_start(GTK_BOX(hhbox), d->compress_button, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hhbox), d->create_button, FALSE, FALSE, 0); /* add history list and buttonbox to widget */ gtk_box_pack_start(GTK_BOX(self->widget), d->history_box, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(self->widget), hhbox, FALSE, FALSE, 0); gtk_widget_show_all(self->widget); /* connect to history change signal for updating the history view */ dt_control_signal_connect(darktable.signals, DT_SIGNAL_DEVELOP_HISTORY_CHANGE, G_CALLBACK(_lib_history_change_callback), self); }
static void toggle_full_vcard(GtkWidget *button, gpointer data) { EABVCardControl *vcard_control = data; char *label; if (!vcard_control->card_list) return; if (vcard_control->render_mode == EAB_CONTACT_DISPLAY_RENDER_NORMAL) { vcard_control->render_mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT; label = _("Show Full vCard"); } else { vcard_control->render_mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL; label = _("Show Compact vCard"); } gtk_button_set_label (GTK_BUTTON (button), label); eab_contact_display_render (vcard_control->display, E_CONTACT (vcard_control->card_list->data), vcard_control->render_mode); }
static void label_buttons(SPIBoolean shifted) { int i, j; KeySym keysym; KeyCode keycode = MIN_KEYCODE; char label[LABELMAXLEN] = " "; char *button_label; char *keysymstring; for (i=0; i<MAX_ROWS-1; ++i) /* last row doesn't change */ { for (j=0; j<MAX_COLUMNS; ++j, ++keycode) { keysym = (KeySym) XKeycodeToKeysym (GDK_DISPLAY(), keycode, shifted ? 1 : 0); /* Note: these routines are not i18n-savvy, we need to use XIM, other methods here */ if (keysym && g_ascii_isprint((int)keysym)) { g_snprintf (label, 2, "%c", (int) keysym); } else { keysymstring = XKeysymToString (keysym); if (keysymstring) { /* KP_ means keypad... we won't expose this difference */ if (!strncmp (keysymstring, "KP_", 3)) strncpy (label, (char *)(keysymstring+3), LABELMAXLEN); else strncpy (label, keysymstring, LABELMAXLEN); } else *label = 0; } button_label = *label==' ' ? " space " : label; gtk_button_set_label (buttons[i][j], button_label); } } }
GtkWidget * gtkutil_button (GtkWidget *box, char *stock, char *tip, void *callback, void *userdata, char *labeltext) { GtkWidget *wid, *img, *bbox; wid = gtk_button_new (); if (labeltext) { gtk_button_set_label (GTK_BUTTON (wid), labeltext); gtk_button_set_image (GTK_BUTTON (wid), gtk_image_new_from_stock (stock, GTK_ICON_SIZE_MENU)); gtk_button_set_use_underline (GTK_BUTTON (wid), TRUE); if (box) gtk_container_add (GTK_CONTAINER (box), wid); } else { bbox = gtk_hbox_new (0, 0); gtk_container_add (GTK_CONTAINER (wid), bbox); gtk_widget_show (bbox); img = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_MENU); if (stock == GTK_STOCK_GOTO_LAST) gtk_widget_set_usize (img, 10, 6); gtk_container_add (GTK_CONTAINER (bbox), img); gtk_widget_show (img); gtk_box_pack_start (GTK_BOX (box), wid, 0, 0, 0); } g_signal_connect (G_OBJECT (wid), "clicked", G_CALLBACK (callback), userdata); gtk_widget_show (wid); if (tip) add_tip (wid, tip); return wid; }
static GtkWidget * toolbar_create_toolbutton (NautilusToolbar *self, gboolean create_menu, gboolean create_toggle, const gchar *name, const gchar *tooltip) { GtkWidget *button, *image; GtkActionGroup *action_group; GtkAction *action; action_group = nautilus_window_get_main_action_group (self->priv->window); if (create_menu) { button = gtk_menu_button_new (); } else if (create_toggle) { button = gtk_toggle_button_new (); } else { button = gtk_button_new (); } image = gtk_image_new (); gtk_button_set_image (GTK_BUTTON (button), image); if (create_menu) { gtk_image_set_from_icon_name (GTK_IMAGE (image), name, GTK_ICON_SIZE_MENU); gtk_widget_set_tooltip_text (button, tooltip); } else { action = gtk_action_group_get_action (action_group, name); gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), action); gtk_button_set_label (GTK_BUTTON (button), NULL); gtk_widget_set_tooltip_text (button, gtk_action_get_tooltip (action)); } return button; }
void gam_toggle_set_display_name (GamToggle *gam_toggle, const gchar *name) { GamTogglePrivate *priv; gchar *key; g_return_if_fail (GAM_IS_TOGGLE (gam_toggle)); priv = GAM_TOGGLE_GET_PRIVATE (gam_toggle); key = g_strdup_printf ("/apps/gnome-alsamixer/toggle_display_names/%s-%s", gam_mixer_get_config_name (GAM_MIXER (priv->mixer)), gam_toggle_get_config_name (gam_toggle)); gconf_client_set_string (gam_app_get_gconf_client (GAM_APP (priv->app)), key, name, NULL); gconf_client_suggest_sync (gam_app_get_gconf_client (GAM_APP (priv->app)), NULL); gtk_button_set_label (GTK_BUTTON (gam_toggle), name); }
static void gvc_combo_box_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GvcComboBox *self = GVC_COMBO_BOX (object); switch (prop_id) { case PROP_LABEL: gtk_label_set_text_with_mnemonic (GTK_LABEL (self->priv->label), g_value_get_string (value)); break; case PROP_BUTTON_LABEL: gtk_button_set_label (GTK_BUTTON (self->priv->button), g_value_get_string (value)); break; case PROP_SHOW_BUTTON: gtk_widget_set_visible (self->priv->button, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
/** * Process export address dialog. * \param cache Address book/data source cache. */ void addressbook_exp_ldif( AddressCache *cache ) { /* Set references to control data */ _addressCache_ = cache; _exportCtl_ = exportldif_create(); exportldif_load_settings( _exportCtl_ ); /* Setup GUI */ if( ! expldif_dlg.window ) export_ldif_create(); gtk_button_set_label(GTK_BUTTON(expldif_dlg.btnCancel), GTK_STOCK_CANCEL); expldif_dlg.cancelled = FALSE; gtk_widget_show(expldif_dlg.window); manage_window_set_transient(GTK_WINDOW(expldif_dlg.window)); gtk_window_set_modal(GTK_WINDOW(expldif_dlg.window), TRUE); gtk_label_set_text( GTK_LABEL(expldif_dlg.labelBook), cache->name ); gtk_label_set_text( GTK_LABEL(expldif_dlg.labelOutBook), cache->name ); export_ldif_fill_fields( _exportCtl_ ); gtk_widget_grab_default(expldif_dlg.btnNext); gtk_notebook_set_current_page( GTK_NOTEBOOK(expldif_dlg.notebook), PAGE_FILE_INFO ); gtk_widget_set_sensitive( expldif_dlg.btnPrev, FALSE ); gtk_widget_set_sensitive( expldif_dlg.btnNext, TRUE ); export_ldif_message(); gtk_widget_grab_focus(expldif_dlg.entryLdif); gtk_main(); gtk_widget_hide(expldif_dlg.window); gtk_window_set_modal(GTK_WINDOW(expldif_dlg.window), FALSE); exportldif_free( _exportCtl_ ); _exportCtl_ = NULL; _addressCache_ = NULL; }
void linphone_gtk_in_call_view_show_encryption(LinphoneCall *call) { GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *encryption_box=linphone_gtk_get_widget(callview,"encryption_box"); GtkWidget *label=linphone_gtk_get_widget(callview,"encryption_label"); GtkWidget *status_icon=linphone_gtk_get_widget(callview,"encryption_status_icon"); GtkWidget *verify_button=linphone_gtk_get_widget(callview,"encryption_verify_button"); LinphoneMediaEncryption me=linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)); bool_t verified=linphone_call_get_authentication_token_verified(call); switch(me) { case LinphoneMediaEncryptionSRTP: gtk_widget_show_all(encryption_box); gtk_label_set_markup(GTK_LABEL(label),_("Secured by SRTP")); gtk_widget_hide(status_icon); gtk_widget_hide(verify_button); break; case LinphoneMediaEncryptionDTLS: gtk_widget_show_all(encryption_box); gtk_label_set_markup(GTK_LABEL(label),_("Secured by DTLS")); gtk_widget_hide(status_icon); gtk_widget_hide(verify_button); break; case LinphoneMediaEncryptionZRTP: { gchar *text=g_strdup_printf(_("Secured by ZRTP - [auth token: %s]"),linphone_call_get_authentication_token(call)); gtk_label_set_markup(GTK_LABEL(label),text); g_free(text); gtk_image_set_from_stock(GTK_IMAGE(status_icon), verified ? GTK_STOCK_APPLY : GTK_STOCK_DIALOG_WARNING,GTK_ICON_SIZE_MENU); gtk_button_set_label(GTK_BUTTON(verify_button), verified ? _("Set unverified") : _("Set verified")); gtk_widget_show_all(encryption_box); } break; default: gtk_widget_hide_all(encryption_box); } }
static void update_hist_button() { int i; for(i=0;i<gcb_history_n;i++) { char tstr[16]; if (!hist_strArr[i]) continue; utf8ncpy(tstr, sizeof(tstr), hist_strArr[i]); del_nl(tstr); gtk_button_set_label(GTK_BUTTON(hist_buttonArr[i]),tstr); #if 0 #if GTK_CHECK_VERSION(2,12,0) gtk_widget_set_tooltip_text (hist_buttonArr[i], hist_strArr[i]); #else gtk_tooltips_set_tip (GTK_TOOLTIPS (button_bar_tips),hist_buttonArr[i], hist_strArr[i],NULL); #endif #endif } }
static GObject* gam_toggle_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { GObject *object; GamToggle *gam_toggle; object = (* G_OBJECT_CLASS (parent_class)->constructor) (type, n_construct_properties, construct_params); gam_toggle = GAM_TOGGLE (object); gtk_button_set_label (GTK_BUTTON (gam_toggle), gam_toggle_get_display_name (gam_toggle)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gam_toggle), gam_toggle_get_state (gam_toggle)); g_signal_connect (G_OBJECT (gam_toggle), "toggled", G_CALLBACK (gam_toggle_toggled_cb), gam_toggle); return object; }
void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call) { GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status"); GtkWidget *callee=linphone_gtk_get_widget(callview,"in_call_uri"); GtkWidget *answer_button; GtkWidget *image; gtk_label_set_markup(GTK_LABEL(status),_("<b>Incoming call</b>")); gtk_widget_show_all(linphone_gtk_get_widget(callview,"answer_decline_panel")); gtk_widget_hide(linphone_gtk_get_widget(callview,"buttons_panel")); display_peer_name_in_label(callee,linphone_call_get_remote_address (call)); answer_button=linphone_gtk_get_widget(callview,"accept_call"); image=create_pixmap (linphone_gtk_get_ui_config("start_call_icon","startcall-small.png")); gtk_button_set_label(GTK_BUTTON(answer_button),_("Answer")); gtk_button_set_image(GTK_BUTTON(answer_button),image); gtk_widget_show(image); image=create_pixmap (linphone_gtk_get_ui_config("stop_call_icon","stopcall-small.png")); gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(callview,"decline_call")),image); gtk_widget_show(image); linphone_gtk_in_call_set_animation_image(callview,GTK_STOCK_DIALOG_INFO,TRUE); }
void handler_open(GtkWidget *button, OPEN_CALLBACK_PARAM_T *param) { GtkWidget *dialog; dialog = gtk_file_chooser_dialog_new ( "Select raw image ...", GTK_WINDOW(param->window), GTK_FILE_CHOOSER_ACTION_SAVE, "_Cancel", GTK_RESPONSE_CANCEL, "_Open", GTK_RESPONSE_ACCEPT, NULL ); gint result = gtk_dialog_run(GTK_DIALOG(dialog)); if (result == GTK_RESPONSE_ACCEPT) { FilenameRawYUV[param->eCh] = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); gtk_button_set_label(GTK_BUTTON(button), basename(FilenameRawYUV[param->eCh])); } gtk_widget_destroy(dialog); }
static void animation_render_ui_stop(AnimationRenderUi *self) { GtkWidget *close; self->render_in_progress = FALSE; self->confirm_on = FALSE; close = glade_xml_get_widget(self->xml, "cancel"); gtk_button_set_label(GTK_BUTTON(close), GTK_STOCK_CLOSE); avi_writer_close(self->avi); g_object_unref(self->avi); self->avi = NULL; g_source_remove(self->idler); self->idler = 0; gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(glade_xml_get_widget(self->xml, "animation_progress")), 0); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(glade_xml_get_widget(self->xml, "frame_progress")), 0); gtk_widget_set_sensitive(glade_xml_get_widget(self->xml, "ok"), TRUE); gtk_widget_set_sensitive(glade_xml_get_widget(self->xml, "settings_box"), TRUE); gtk_widget_set_sensitive(glade_xml_get_widget(self->xml, "progress_box"), FALSE); }
static void ui_login_clicked(GtkButton *button, gpointer data) { dt_storage_facebook_gui_data_t *ui = (dt_storage_facebook_gui_data_t *)data; if(ui->connected == FALSE) { ui_authenticate(ui); } else // disconnect user { if(ui->facebook_api->token != NULL) { GtkTreeModel *model = gtk_combo_box_get_model(ui->comboBox_username); GtkTreeIter iter; gtk_combo_box_get_active_iter(ui->comboBox_username, &iter); gchar *userid; gtk_tree_model_get(model, &iter, COMBO_USER_MODEL_ID_COL, &userid, -1); remove_account_info(userid); gtk_button_set_label(ui->button_login, _("login")); gtk_widget_set_sensitive(GTK_WIDGET(ui->comboBox_album), FALSE); ui_refresh_users(ui); ui->connected = FALSE; } } }
/* Signal handler called when the selections owner returns the data */ void disp_gcb_selection(const gchar *text) { // dbg("selection_received '%s'\n", text); char *tmpstr; GtkWidget *button = snoop_button; int i; int textlen; static char bombom[]="\xef\xbb\xbf\xef\xbb\xbf"; if (!text || !text[0]) return; textlen=strlen(text); if (textlen==1 && text[0] <= ' ') return; // google chrome if (!strcmp(text,bombom)) return; #if 0 dbg("textlen %d\n", textlen); for(i=0; i < textlen;i++) dbg("%x ", (unsigned char)text[i]); dbg("\n"); #endif if (!buttonArr) return; for(i=0;i<gcb_button_n;i++) { if (buttonStr[i] && !strcmp(buttonStr[i],text)) return; } tmpstr=(char *)g_malloc(maxButtonStrlen); utf8ncpy(tmpstr, maxButtonStrlen, (char *)text); del_nl(tmpstr); for(i=0;i<gcb_button_n;i++) { if (buttonArr[i]==button) { if (buttonStr[i]) g_free(buttonStr[i]); buttonStr[i]=g_strdup(text); } } gtk_button_set_label(GTK_BUTTON(button),tmpstr); set_win_title(text); #if GTK_CHECK_VERSION(2,12,0) gtk_widget_set_tooltip_text (button, text); #else gtk_tooltips_set_tip (GTK_TOOLTIPS (button_bar_tips), button, text,NULL); #endif g_free(tmpstr); gtk_window_resize(GTK_WINDOW(mainwin), 100, 24); // remove the duplicate item if any for(i=0;i< gcb_history_n; i++) { if (!hist_strArr[i]) continue; int len = strlen(hist_strArr[i]); if (strncmp(hist_strArr[i], text, len)) continue; g_free(hist_strArr[i]); memmove(&hist_strArr[i],&hist_strArr[i+1], sizeof(hist_strArr[0])*(gcb_history_n - i - 1)); hist_strArr[gcb_history_n-1]=NULL; break; } g_free(hist_strArr[gcb_history_n-1]); memmove(&hist_strArr[1],&hist_strArr[0], sizeof(hist_strArr[0])*(gcb_history_n-1)); hist_strArr[0]=g_strdup(text); update_hist_button(); }
static void changed(GtkEditable *editable, gpointer data) { gtk_button_set_label(GTK_BUTTON(data), gtk_entry_get_text(GTK_ENTRY(editable))); gtk_widget_queue_resize(GTK_WIDGET(data)); }
void cgraphics_radiobutton_set_text( widget_t *widget ) { radiobutton_widget_t *radio = (radiobutton_widget_t *)widget; gtk_button_set_label( widget->native, radio->text ); }
static void panel_addto_selection_changed (GtkTreeSelection *selection, PanelAddtoDialog *dialog) { GtkTreeModel *filter_model; GtkTreeModel *child_model; GtkTreeIter iter; GtkTreeIter filter_iter; PanelAddtoItemInfo *data; char *iid; if (!gtk_tree_selection_get_selected (selection, &filter_model, &filter_iter)) { gtk_widget_set_sensitive (GTK_WIDGET (dialog->add_button), FALSE); return; } gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (filter_model), &iter, &filter_iter); child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (filter_model)); gtk_tree_model_get (child_model, &iter, COLUMN_DATA, &data, -1); if (!data) { gtk_widget_set_sensitive (GTK_WIDGET (dialog->add_button), FALSE); return; } gtk_widget_set_sensitive (GTK_WIDGET (dialog->add_button), TRUE); if (data->type == PANEL_ADDTO_LAUNCHER_MENU) { gtk_button_set_label (GTK_BUTTON (dialog->add_button), GTK_STOCK_GO_FORWARD); } else { gtk_button_set_label (GTK_BUTTON (dialog->add_button), GTK_STOCK_ADD); } gtk_button_set_use_stock (GTK_BUTTON (dialog->add_button), TRUE); /* only allow dragging applets if we can add applets */ if (panel_profile_id_lists_are_writable ()) { switch (data->type) { case PANEL_ADDTO_LAUNCHER: panel_addto_setup_launcher_drag (GTK_TREE_VIEW (dialog->tree_view), data->launcher_path); break; case PANEL_ADDTO_APPLET: panel_addto_setup_applet_drag (GTK_TREE_VIEW (dialog->tree_view), data->iid); break; case PANEL_ADDTO_LAUNCHER_MENU: gtk_tree_view_unset_rows_drag_source (GTK_TREE_VIEW (dialog->tree_view)); break; case PANEL_ADDTO_MENU: /* build the iid for menus other than the main menu */ if (data->iid == NULL) { iid = g_strdup_printf ("MENU:%s/%s", data->menu_filename, data->menu_path); } else { iid = g_strdup (data->iid); } panel_addto_setup_internal_applet_drag (GTK_TREE_VIEW (dialog->tree_view), iid); g_free (iid); break; default: panel_addto_setup_internal_applet_drag (GTK_TREE_VIEW (dialog->tree_view), data->iid); break; } } }
int main(int argc, char** argv) { GtkBuilder* builder; char* str = NULL; GKeyFile* kf = g_key_file_new(); const char* session_name = g_getenv("DESKTOP_SESSION"); /* load settings from current session config files */ if(!session_name) session_name = "LXDE"; char* rel_path = g_strconcat("lxsession/", session_name, "/desktop.conf", NULL); char* user_config_file = g_build_filename(g_get_user_config_dir(), rel_path, NULL); #ifdef ENABLE_NLS bindtextdomain ( GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR ); bind_textdomain_codeset ( GETTEXT_PACKAGE, "UTF-8" ); textdomain ( GETTEXT_PACKAGE ); #endif gtk_init(&argc, &argv); gtk_icon_theme_prepend_search_path(gtk_icon_theme_get_default(), PACKAGE_DATA_DIR); /* build the UI */ builder = gtk_builder_new(); gtk_builder_add_from_file( builder, PACKAGE_DATA_DIR "/lxinput.ui", NULL ); dlg = (GtkWidget*)gtk_builder_get_object( builder, "dlg" ); gtk_dialog_set_alternative_button_order( (GtkDialog*)dlg, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1 ); mouse_accel = (GtkRange*)gtk_builder_get_object(builder,"mouse_accel"); mouse_threshold = (GtkRange*)gtk_builder_get_object(builder,"mouse_threshold"); mouse_left_handed = (GtkToggleButton*)gtk_builder_get_object(builder,"left_handed"); mouse_dclick = (GtkRange*)gtk_builder_get_object(builder, "mouse_dclick"); kb_delay = (GtkRange*)gtk_builder_get_object(builder,"kb_delay"); kb_interval = (GtkRange*)gtk_builder_get_object(builder,"kb_interval"); kb_beep = (GtkToggleButton*)gtk_builder_get_object(builder,"beep"); kb_layout = (GtkButton*)gtk_builder_get_object(builder,"keyboard_layout"); const gchar *program = detect_keymap_program(); if (program == NULL) { /* Hide the button if there is no program to set keymap */ kb_layout_label = (GtkLabel*)gtk_builder_get_object(builder,"keyboard_layout_label"); gtk_widget_set_visible(GTK_WIDGET(kb_layout_label), FALSE); gtk_widget_set_visible(GTK_WIDGET(kb_layout), FALSE); } else { gtk_button_set_label(kb_layout, _("Keyboard Layout...")); } g_object_unref( builder ); /* read the config flie */ load_settings(); /* init the UI */ gtk_range_set_value(mouse_accel, (gdouble)accel / 10.0); gtk_range_set_value(mouse_threshold, threshold); gtk_range_set_value(mouse_dclick, dclick); gtk_toggle_button_set_active(mouse_left_handed, left_handed); gtk_range_set_value(kb_delay, delay); gtk_range_set_value(kb_interval, interval); gtk_toggle_button_set_active(kb_beep, beep); set_range_stops(mouse_accel, 10); g_signal_connect(mouse_accel, "value-changed", G_CALLBACK(on_mouse_accel_changed), NULL); set_range_stops(mouse_threshold, 10); g_signal_connect(mouse_threshold, "value-changed", G_CALLBACK(on_mouse_threshold_changed), NULL); g_signal_connect(mouse_left_handed, "toggled", G_CALLBACK(on_left_handed_toggle), NULL); g_signal_connect(mouse_dclick, "value-changed", G_CALLBACK(on_mouse_dclick_changed), NULL); set_range_stops(kb_delay, 10); g_signal_connect(kb_delay, "value-changed", G_CALLBACK(on_kb_range_changed), &delay); set_range_stops(kb_interval, 10); g_signal_connect(kb_interval, "value-changed", G_CALLBACK(on_kb_range_changed), &interval); g_signal_connect(kb_beep, "toggled", G_CALLBACK(on_kb_beep_toggle), NULL); g_signal_connect(kb_layout, "clicked", G_CALLBACK(on_kb_layout_clicked), NULL); if( gtk_dialog_run( (GtkDialog*)dlg ) == GTK_RESPONSE_OK ) { gsize len; if(!g_key_file_load_from_file(kf, user_config_file, G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS, NULL)) { /* the user config file doesn't exist, create its parent dir */ len = strlen(user_config_file) - strlen("/desktop.conf"); user_config_file[len] = '\0'; g_debug("user_config_file = %s", user_config_file); g_mkdir_with_parents(user_config_file, 0700); user_config_file[len] = '/'; g_key_file_load_from_dirs(kf, rel_path, (const char**)g_get_system_config_dirs(), NULL, G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS, NULL); } g_free(rel_path); g_key_file_set_integer(kf, "Mouse", "AccFactor", accel); g_key_file_set_integer(kf, "Mouse", "AccThreshold", threshold); g_key_file_set_integer(kf, "Mouse", "LeftHanded", !!left_handed); g_key_file_set_integer(kf, "Keyboard", "Delay", delay); g_key_file_set_integer(kf, "Keyboard", "Interval", interval); g_key_file_set_integer(kf, "Keyboard", "Beep", !!beep); str = g_key_file_to_data(kf, &len, NULL); g_file_set_contents(user_config_file, str, len, NULL); g_free(str); /* ask the settigns daemon to reload */ /* FIXME: is this needed? */ /* g_spawn_command_line_sync("lxde-settings-daemon reload", NULL, NULL, NULL, NULL); */ /* also save settings into autostart file for non-lxsession sessions */ g_free(user_config_file); rel_path = g_build_filename(g_get_user_config_dir(), "autostart", NULL); user_config_file = g_build_filename(rel_path, "LXinput-setup.desktop", NULL); if (g_mkdir_with_parents(rel_path, 0755) == 0) { str = g_strdup_printf("[Desktop Entry]\n" "Type=Application\n" "Name=%s\n" "Comment=%s\n" "NoDisplay=true\n" "Exec=sh -c 'xset m %d/10 %d r rate %d %d b %s'\n" "NotShowIn=GNOME;KDE;XFCE;\n", _("LXInput autostart"), _("Setup keyboard and mouse using settings done in LXInput"), /* FIXME: how to setup left-handed mouse? */ accel, threshold, delay, interval, beep ? "on" : "off"); g_file_set_contents(user_config_file, str, -1, NULL); g_free(str); } } else { /* restore to original settings */ /* keyboard */ delay = old_delay; interval = old_interval; beep = old_beep; XkbSetAutoRepeatRate(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbUseCoreKbd, delay, interval); /* FIXME: beep? */ /* mouse */ accel = old_accel; threshold = old_threshold; left_handed = old_left_handed; XChangePointerControl(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), True, True, accel, 10, threshold); set_left_handed_mouse(); set_dclick_time (old_dclick); } gtk_widget_destroy( dlg ); g_free( file ); g_key_file_free( kf ); g_free(user_config_file); return 0; }
void on_checkbuttonDateEngine_toggled(GtkButton *button, struct _properties *properties) { //g_print("on_checkbuttonDateEngine_toggled()\n"); if( properties->GtkInfo.checkbuttonDateEngineIgnore == true ) { g_print("checkbuttonDateEngineIgnored\n"); properties->GtkInfo.checkbuttonDateEngineIgnore = false; return; } if( option_algorithms[properties->modeltype].supportTime2 == 1 ) { return; } if( option_algorithms[properties->modeltype].perpetual ) { return; } if( properties->decimalorcalendar == DECIMALS ) { // switch to calendar dated... //g_print("Calendar Dated\n"); properties->decimalorcalendar = CALENDAR; if( option_algorithms[properties->modeltype].assetClass ) { properties->format = CALENDAR_FUTURE; } else { properties->format = CALENDAR_OPTIONS3; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(properties->GtkInfo.radiobutton1),true); // CALENDAR_OPTIONS3 if( option_algorithms[properties->modeltype].supportStrikes ) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(properties->GtkInfo.radiobutton2),false); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(properties->GtkInfo.radiobutton3),false); } gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(properties->GtkInfo.radiobutton4),false); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(properties->GtkInfo.radiobutton5),false); gtk_widget_hide(properties->GtkInfo.spinbuttonCustomStrike); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(properties->GtkInfo.checkbuttonSpreads),0); gtk_widget_hide(properties->GtkInfo.checkbuttonSpreads); if( option_algorithms[properties->modeltype].supportStrikes && strike_control[properties->strikestoogle].incrementor != 0 ) { gtk_button_set_label(GTK_BUTTON(properties->GtkInfo.scaleStrikes),"Strike Adjuster"); gtk_widget_show(properties->GtkInfo.scaleStrikes); } else { gtk_widget_hide(properties->GtkInfo.scaleStrikes); } gtk_button_set_label(GTK_BUTTON(properties->GtkInfo.scaleMonths),"Month Adjuster"); gtk_widget_show(properties->GtkInfo.scaleMonths); } //properties->format = CALENDAR_OPTIONS4; //properties->format = CALENDAR_OPTIONS5; //properties->format = CALENDAR_OPTIONS6; //properties->format = CALENDAR_CUSTOM; gtk_widget_hide(properties->GtkInfo.checkbuttonRealTime); gtk_widget_hide(properties->GtkInfo.buttonCalendar); gtk_widget_hide(properties->GtkInfo.spinbuttonTime); gtk_widget_hide(properties->GtkInfo.label1); gtk_widget_hide(properties->GtkInfo.labelDaysToExpr); gtk_widget_hide(properties->GtkInfo.spinbuttonDaysToExpr); gtk_widget_hide(properties->GtkInfo.labelTime1); if( !option_algorithms[properties->modeltype].assetClass ) { gtk_widget_show(properties->GtkInfo.labelCycle); gtk_widget_show(properties->GtkInfo.comboboxCycle); gtk_widget_show(properties->GtkInfo.radiobutton1); if( option_algorithms[properties->modeltype].supportStrikes ) { gtk_widget_show(properties->GtkInfo.radiobutton2); gtk_widget_show(properties->GtkInfo.radiobutton3); } gtk_widget_show(properties->GtkInfo.radiobutton4); gtk_widget_show(properties->GtkInfo.radiobutton5); gtk_widget_show(properties->GtkInfo.labelDisplayFormats); } show_label_expirations(properties); gtk_widget_show(properties->GtkInfo.scaleMonths); gtk_widget_show(properties->GtkInfo.buttonProperties); gtk_widget_show(properties->GtkInfo.checkbuttonSpreads); } else { // switch to decimal dated... //g_print("Decimal Dated\n"); properties->decimalorcalendar = DECIMALS; if( option_algorithms[properties->modeltype].assetClass ) { properties->format = DECIMAL_FUTURE; } else { properties->format = DECIMAL_GREEKS; if( option_algorithms[properties->modeltype].supportStrikes ) { gtk_widget_show(properties->GtkInfo.comboboxStrikes); gtk_widget_show(properties->GtkInfo.scaleStrikes); gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes),"Strikes"); gtk_widget_show(properties->GtkInfo.labelStrikes); } else { gtk_widget_hide(properties->GtkInfo.comboboxStrikes); gtk_widget_hide(properties->GtkInfo.scaleStrikes); gtk_widget_hide(properties->GtkInfo.labelStrikes); } } gtk_widget_show(properties->GtkInfo.checkbuttonRealTime); gtk_widget_show(properties->GtkInfo.buttonCalendar); gtk_widget_show(properties->GtkInfo.spinbuttonTime); gtk_widget_show(properties->GtkInfo.label1); gtk_widget_show(properties->GtkInfo.labelDaysToExpr); gtk_widget_show(properties->GtkInfo.spinbuttonDaysToExpr); gtk_widget_show(properties->GtkInfo.labelTime1); gtk_widget_hide(properties->GtkInfo.labelCycle); gtk_widget_hide(properties->GtkInfo.comboboxCycle); gtk_widget_hide(properties->GtkInfo.labelExpirations); gtk_widget_hide(properties->GtkInfo.scaleMonths); gtk_widget_hide(properties->GtkInfo.buttonProperties); gtk_widget_hide(properties->GtkInfo.radiobutton1); gtk_widget_hide(properties->GtkInfo.radiobutton2); gtk_widget_hide(properties->GtkInfo.radiobutton3); gtk_widget_hide(properties->GtkInfo.radiobutton4); gtk_widget_hide(properties->GtkInfo.radiobutton5); gtk_widget_hide(properties->GtkInfo.labelDisplayFormats); gtk_widget_hide(properties->GtkInfo.labelStrikes2); gtk_widget_hide(properties->GtkInfo.spinbuttonCustomStrike); gtk_widget_hide(properties->GtkInfo.spinbuttonCustomStrike2); gtk_widget_hide(properties->GtkInfo.checkbuttonSpreads); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(properties->GtkInfo.checkbuttonSpreads),0); properties->data.t[0] = gtk_spin_button_get_value(GTK_SPIN_BUTTON(properties->GtkInfo.spinbuttonTime)); if( strike_control[properties->strikestoogle].incrementor == 0 ) { gtk_widget_show(properties->GtkInfo.spinbuttonCustomStrike2); gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes2),"Strike"); gtk_widget_show(properties->GtkInfo.labelStrikes2); gtk_widget_hide(properties->GtkInfo.scaleStrikes); } else { gtk_widget_hide(properties->GtkInfo.spinbuttonCustomStrike2); gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes2),"StrikeLeg2"); gtk_widget_hide(properties->GtkInfo.labelStrikes2); gtk_widget_show(properties->GtkInfo.scaleStrikes); } } setup_tree_view(properties); show_title(properties); } // void on_checkbuttonDateEngine_toggled(GtkButton *button, struct _properties *properties)
void on_checkbuttonSpreads_toggled(GtkButton *button, struct _properties *properties) { if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (button)) ) { g_print("Use Spreads\n"); properties->spreads = 1; calc_strike_scale(properties); if( properties->format != CALENDAR_CUSTOM && !option_algorithms[properties->modeltype].assetClass && option_algorithms[properties->modeltype].supportStrikes && strike_control[properties->strikestoogle].incrementor != 0 ) { gtk_button_set_label(GTK_BUTTON(properties->GtkInfo.scaleStrikes),"Strike Adj Leg1"); gtk_widget_show(properties->GtkInfo.scaleStrikes); gtk_widget_show(properties->GtkInfo.scaleStrikes2); } if( properties->format == CALENDAR_CUSTOM && !option_algorithms[properties->modeltype].assetClass && option_algorithms[properties->modeltype].supportStrikes && strike_control[properties->strikestoogle].incrementor != 0 ) { gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes),"StrikeLeg1"); gtk_widget_show(properties->GtkInfo.labelStrikes); gtk_widget_show(properties->GtkInfo.spinbuttonCustomStrike2); gtk_widget_show(properties->GtkInfo.labelStrikes2); } if( strike_control[properties->strikestoogle].incrementor == 0 && properties->format != CALENDAR_CUSTOM ) { gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes),"StrikeLeg1"); gtk_widget_show(properties->GtkInfo.labelStrikes); gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes2),"StrikeLeg2"); gtk_widget_show(properties->GtkInfo.labelStrikes2); gtk_widget_show(properties->GtkInfo.spinbuttonCustomStrike); gtk_widget_hide(properties->GtkInfo.comboboxStrikes); gtk_widget_show(properties->GtkInfo.spinbuttonCustomStrike2); } gtk_button_set_label(GTK_BUTTON(properties->GtkInfo.scaleMonths),"Month Adj Leg1"); gtk_widget_show(properties->GtkInfo.scaleMonths); gtk_widget_show(properties->GtkInfo.scaleMonths2); } else { g_print("No Spreads\n"); properties->spreads = 0; calc_strike_scale(properties); gtk_widget_hide(properties->GtkInfo.labelSpread); if( properties->format != CALENDAR_CUSTOM && !option_algorithms[properties->modeltype].assetClass && option_algorithms[properties->modeltype].supportStrikes && strike_control[properties->strikestoogle].incrementor != 0 ) { gtk_button_set_label(GTK_BUTTON(properties->GtkInfo.scaleStrikes),"Strike Adjuster"); gtk_widget_show(properties->GtkInfo.scaleStrikes); } if( properties->format == CALENDAR_CUSTOM && !option_algorithms[properties->modeltype].assetClass && option_algorithms[properties->modeltype].supportStrikes ) { gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes),"Strike"); gtk_widget_show(properties->GtkInfo.labelStrikes); gtk_widget_hide(properties->GtkInfo.spinbuttonCustomStrike2); gtk_widget_hide(properties->GtkInfo.labelStrikes2); } gtk_button_set_label(GTK_BUTTON(properties->GtkInfo.scaleMonths),"Month Adjuster"); gtk_widget_hide(properties->GtkInfo.scaleStrikes2); if( properties->decimalorcalendar == CALENDAR ) gtk_widget_show(properties->GtkInfo.scaleMonths); gtk_widget_hide(properties->GtkInfo.scaleMonths2); if( strike_control[properties->strikestoogle].incrementor == 0 && properties->format != CALENDAR_CUSTOM ) { gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes),"Strikes"); gtk_widget_show(properties->GtkInfo.labelStrikes); gtk_label_set_text(GTK_LABEL(properties->GtkInfo.labelStrikes2),"Strike"); gtk_widget_hide(properties->GtkInfo.spinbuttonCustomStrike); gtk_widget_hide(properties->GtkInfo.scaleStrikes); gtk_widget_show(properties->GtkInfo.comboboxStrikes); } } setup_tree_view(properties); } // void on_checkbuttonSpreads_toggled(GtkButton *button, struct _properties *properties)
/////////////////////////////////////////////////////////////////////////// // set text /////////////////////////////////////////////////////////////////////////// void edit_overview_set_text(void) { CN_LOGPRINTF("entry"); GtkWidget *widget; if (g_overview) { gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_overview), _("Network profile")); } if (g_address) { widget = g_address->details->label; gtk_label_set_text(GTK_LABEL(widget), _("Select how your iLiad gets a network address.")); widget = GTK_WIDGET(g_address->details->buttonList[0]); gtk_button_set_label(GTK_BUTTON(widget), _("Automatic")); widget = GTK_WIDGET(g_address->details->buttonList[1]); gtk_button_set_label(GTK_BUTTON(widget), _("Static")); } if (g_proxy) { widget = g_proxy->details->label; gtk_label_set_text(GTK_LABEL(widget), _("Select if there is a proxy server present.")); widget = GTK_WIDGET(g_proxy->details->buttonList[0]); gtk_button_set_label(GTK_BUTTON(widget), _("No proxy")); widget = GTK_WIDGET(g_proxy->details->buttonList[1]); gtk_button_set_label(GTK_BUTTON(widget), _("Proxy")); } if (g_profilename) { widget = g_profilename->details->label; gtk_label_set_text(GTK_LABEL(widget), _("You can personalize the profile name.")); } if (g_buttons) { widget = g_buttons->details->label; gtk_label_set_text(GTK_LABEL(widget), _("Select an action for this profile.")); widget = GTK_WIDGET(g_buttons->details->buttonList[0]); gtk_button_set_label(GTK_BUTTON(widget), _("Test")); widget = GTK_WIDGET(g_buttons->details->buttonList[1]); gtk_button_set_label(GTK_BUTTON(widget), _("Save")); widget = GTK_WIDGET(g_buttons->details->buttonList[2]); gtk_button_set_label(GTK_BUTTON(widget), _("Save & Connect")); } edit_overview_update_info_text(inputDetails_e); }
void *refresh(void *ptr) { char *label_text; label_text = (char *) ptr; gtk_button_set_label((GtkButton *) plugin->btn, to_upper(label_text)); }
static void file_list_ready_cb (GList *files, gpointer user_data) { CajaFileConflictDialog *fcd = user_data; CajaFile *src, *dest, *dest_dir; time_t src_mtime, dest_mtime; GtkDialog *dialog; gboolean source_is_dir, dest_is_dir, should_show_type; CajaFileConflictDialogDetails *details; char *primary_text, *message, *secondary_text; const gchar *message_extra; char *src_name, *dest_name, *dest_dir_name, *edit_name; char *label_text; char *size, *date, *type = NULL; GdkPixbuf *pixbuf; GtkWidget *label; GString *str; PangoFontDescription *desc; dialog = GTK_DIALOG (fcd); details = fcd->details; details->handle = NULL; dest_dir = g_list_nth_data (files, 0); dest = g_list_nth_data (files, 1); src = g_list_nth_data (files, 2); src_mtime = caja_file_get_mtime (src); dest_mtime = caja_file_get_mtime (dest); src_name = caja_file_get_display_name (src); dest_name = caja_file_get_display_name (dest); dest_dir_name = caja_file_get_display_name (dest_dir); source_is_dir = caja_file_is_directory (src); dest_is_dir = caja_file_is_directory (dest); type = caja_file_get_mime_type (dest); should_show_type = !caja_file_is_mime_type (src, type); g_free (type); type = NULL; /* Set up the right labels */ if (dest_is_dir) { if (source_is_dir) { primary_text = g_strdup_printf (_("Merge folder \"%s\"?"), dest_name); message_extra = _("Merging will ask for confirmation before replacing any files in " "the folder that conflict with the files being copied."); if (src_mtime > dest_mtime) { message = g_strdup_printf ( _("An older folder with the same name already exists in \"%s\"."), dest_dir_name); } else if (src_mtime < dest_mtime) { message = g_strdup_printf ( _("A newer folder with the same name already exists in \"%s\"."), dest_dir_name); } else { message = g_strdup_printf ( _("Another folder with the same name already exists in \"%s\"."), dest_dir_name); } } else { message_extra = _("Replacing it will remove all files in the folder."); primary_text = g_strdup_printf (_("Replace folder \"%s\"?"), dest_name); message = g_strdup_printf (_("A folder with the same name already exists in \"%s\"."), dest_dir_name); } } else { primary_text = g_strdup_printf (_("Replace file \"%s\"?"), dest_name); message_extra = _("Replacing it will overwrite its content."); if (src_mtime > dest_mtime) { message = g_strdup_printf ( _("An older file with the same name already exists in \"%s\"."), dest_dir_name); } else if (src_mtime < dest_mtime) { message = g_strdup_printf ( _("A newer file with the same name already exists in \"%s\"."), dest_dir_name); } else { message = g_strdup_printf ( _("Another file with the same name already exists in \"%s\"."), dest_dir_name); } } secondary_text = g_strdup_printf ("%s\n%s", message, message_extra); g_free (message); label = gtk_label_new (primary_text); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD_CHAR); gtk_widget_set_size_request (label, 350, -1); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (details->titles_vbox), label, FALSE, FALSE, 0); gtk_widget_modify_font (label, NULL); desc = pango_font_description_new (); pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD); pango_font_description_set_size (desc, pango_font_description_get_size (gtk_widget_get_style (label)->font_desc) * PANGO_SCALE_LARGE); gtk_widget_modify_font (label, desc); pango_font_description_free (desc); gtk_widget_show (label); label = gtk_label_new (secondary_text); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_widget_set_size_request (label, 350, -1); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (details->titles_vbox), label, FALSE, FALSE, 0); gtk_widget_show (label); g_free (primary_text); g_free (secondary_text); /* Set up file icons */ pixbuf = caja_file_get_icon_pixbuf (dest, CAJA_ICON_SIZE_LARGE, TRUE, CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS); details->dest_image = gtk_image_new_from_pixbuf (pixbuf); gtk_box_pack_start (GTK_BOX (details->first_hbox), details->dest_image, FALSE, FALSE, 0); gtk_widget_show (details->dest_image); g_object_unref (pixbuf); pixbuf = caja_file_get_icon_pixbuf (src, CAJA_ICON_SIZE_LARGE, TRUE, CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS); details->src_image = gtk_image_new_from_pixbuf (pixbuf); gtk_box_pack_start (GTK_BOX (details->second_hbox), details->src_image, FALSE, FALSE, 0); gtk_widget_show (details->src_image); g_object_unref (pixbuf); /* Set up labels */ label = gtk_label_new (NULL); date = caja_file_get_string_attribute (dest, "date_modified"); size = caja_file_get_string_attribute (dest, "size"); if (should_show_type) { type = caja_file_get_string_attribute (dest, "type"); } str = g_string_new (NULL); g_string_append_printf (str, "<b>%s</b>\n", _("Original file")); g_string_append_printf (str, "<i>%s</i> %s\n", _("Size:"), size); if (should_show_type) { g_string_append_printf (str, "<i>%s</i> %s\n", _("Type:"), type); } g_string_append_printf (str, "<i>%s</i> %s", _("Last modified:"), date); label_text = str->str; gtk_label_set_markup (GTK_LABEL (label), label_text); gtk_box_pack_start (GTK_BOX (details->first_hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); g_free (size); g_free (type); g_free (date); g_string_erase (str, 0, -1); /* Second label */ label = gtk_label_new (NULL); date = caja_file_get_string_attribute (src, "date_modified"); size = caja_file_get_string_attribute (src, "size"); if (should_show_type) { type = caja_file_get_string_attribute (src, "type"); } g_string_append_printf (str, "<b>%s</b>\n", _("Replace with")); g_string_append_printf (str, "<i>%s</i> %s\n", _("Size:"), size); if (should_show_type) { g_string_append_printf (str, "<i>%s</i> %s\n", _("Type:"), type); } g_string_append_printf (str, "<i>%s</i> %s", _("Last modified:"), date); label_text = g_string_free (str, FALSE); gtk_label_set_markup (GTK_LABEL (label), label_text); gtk_box_pack_start (GTK_BOX (details->second_hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); g_free (size); g_free (date); g_free (type); g_free (label_text); /* Populate the entry */ edit_name = caja_file_get_edit_name (dest); details->conflict_name = edit_name; gtk_entry_set_text (GTK_ENTRY (details->entry), edit_name); if (source_is_dir && dest_is_dir) { gtk_button_set_label (GTK_BUTTON (details->replace_button), _("Merge")); } caja_file_monitor_add (src, fcd, CAJA_FILE_ATTRIBUTES_FOR_ICON); caja_file_monitor_add (dest, fcd, CAJA_FILE_ATTRIBUTES_FOR_ICON); details->src_handler_id = g_signal_connect (src, "changed", G_CALLBACK (file_icons_changed), fcd); details->dest_handler_id = g_signal_connect (dest, "changed", G_CALLBACK (file_icons_changed), fcd); }
void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data) { GtkBuilder *builder = NULL; GtkWidget *dialog; GtkWidget *grid; GtkWidget *text; GtkWidget *button; GSList *tmp; int list_count = 0; int combo_count = 0; int i = 0; zen_data = data; builder = zenity_util_load_ui_file("zenity_forms_dialog", NULL); if (builder == NULL) { data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR); return; } gtk_builder_connect_signals(builder, NULL); dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_dialog")); g_signal_connect (G_OBJECT(dialog), "response", G_CALLBACK (zenity_forms_dialog_response), forms_data); if (data->dialog_title) gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title); if (data->width > -1 || data->height > -1) gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height); if (data->extra_label) { gint i=0; while(data->extra_label[i]!=NULL){ gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i); i++; } } if (data->ok_label) { button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_ok_button")); gtk_button_set_label (GTK_BUTTON (button), data->ok_label); } if (data->cancel_label) { button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_cancel_button")); gtk_button_set_label (GTK_BUTTON (button), data->cancel_label); } text = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_text")); if (forms_data->dialog_text) gtk_label_set_markup (GTK_LABEL (text), g_strcompress (forms_data->dialog_text)); grid = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_grid")); for (tmp = forms_data->list; tmp; tmp = tmp->next) { ZenityFormsValue *zenity_value = (ZenityFormsValue *) tmp->data; GtkWidget *label; gchar **values = g_strsplit_set (zenity_value->option_value, "|", 2); gchar *label_text = values[0]; gchar *prefill_text = values[1]; label = gtk_label_new(label_text); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1); switch(zenity_value->type) { case ZENITY_FORMS_ENTRY: zenity_value->forms_widget = gtk_entry_new(); if (prefill_text) { gtk_entry_set_text(GTK_ENTRY(zenity_value->forms_widget), prefill_text); } break; case ZENITY_FORMS_PASSWORD: zenity_value->forms_widget = gtk_entry_new(); gtk_entry_set_visibility(GTK_ENTRY(zenity_value->forms_widget), FALSE); break; case ZENITY_FORMS_CALENDAR: zenity_value->forms_widget = gtk_calendar_new(); break; case ZENITY_FORMS_LIST: zenity_value->forms_widget = zenity_forms_create_and_fill_list (forms_data, list_count, zenity_value->option_value); list_count++; break; case ZENITY_FORMS_COMBO: zenity_value->forms_widget = zenity_forms_create_and_fill_combo (forms_data, combo_count); combo_count++; break; default: zenity_value->forms_widget = gtk_entry_new(); break; } g_strfreev(values); gtk_grid_attach_next_to (GTK_GRID (grid), GTK_WIDGET (zenity_value->forms_widget), label, GTK_POS_RIGHT, 1, 1); i++; } gtk_widget_show_all (GTK_WIDGET (dialog)); g_object_unref (builder); if (data->timeout_delay > 0) { g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog); } gtk_main(); }
/************************************************************************** Changes the label (with mnemonic) on an existing stockbutton. See gtk_stockbutton_new. **************************************************************************/ void gtk_stockbutton_set_label(GtkWidget *button, const gchar *label_text) { gtk_button_set_label(GTK_BUTTON(button), label_text); }