static void grain_dist_dialog_update_sensitivity(GrainDistControls *controls, GrainDistArgs *args) { GtkWidget *check, *w; check = gwy_table_hscale_get_check(controls->resolution); switch (args->mode) { case MODE_GRAPH: gtk_widget_set_sensitive(check, TRUE); gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(check)); gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(check)); break; case MODE_RAW: gtk_widget_set_sensitive(check, FALSE); w = gwy_table_hscale_get_scale(controls->resolution); gtk_widget_set_sensitive(w, FALSE); w = gwy_table_hscale_get_middle_widget(controls->resolution); gtk_widget_set_sensitive(w, FALSE); break; default: g_assert_not_reached(); break; } gtk_widget_set_sensitive(controls->ok, args->selected & args->bitmask); }
void ugtk_clipboard_form_set (struct UgtkClipboardForm* csform, UgtkSetting* setting) { if (setting->clipboard.pattern) gtk_text_buffer_set_text (csform->buffer, setting->clipboard.pattern, -1); gtk_toggle_button_set_active (csform->monitor, setting->clipboard.monitor); gtk_toggle_button_set_active (csform->quiet, setting->clipboard.quiet); gtk_spin_button_set_value (csform->nth_spin, setting->clipboard.nth_category); gtk_toggle_button_toggled (csform->monitor); gtk_toggle_button_toggled (csform->quiet); // on_clipboard_quiet_mode_toggled ((GtkWidget*) csform->quiet, csform); }
void ugtk_auto_save_form_set (struct UgtkAutoSaveForm* asform, UgtkSetting* setting) { gtk_toggle_button_set_active (asform->enable, setting->auto_save.enable); gtk_spin_button_set_value (asform->interval_spin, (gdouble) setting->auto_save.interval); gtk_toggle_button_toggled (asform->enable); // on_auto_save_toggled ((GtkWidget*) asform->enable, asform); }
static void gtk_menu_button_clicked (GtkButton *button) { GtkMenuButton *menu_button = GTK_MENU_BUTTON (button); GtkMenuButtonPrivate *priv = menu_button->priv; gboolean active = TRUE; if (priv->menu && !gtk_widget_get_visible (priv->menu)) { GdkEvent *event; event = gtk_get_current_event (); popup_menu (menu_button, (event && event->type != GDK_BUTTON_RELEASE) ? (GdkEventButton *) event : NULL); if (!event || event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE) gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->menu), FALSE); if (event) gdk_event_free (event); } else if (priv->popover && !gtk_widget_get_visible (priv->popover)) gtk_widget_show (priv->popover); else active = FALSE; GTK_BUTTON_CLASS (gtk_menu_button_parent_class)->clicked (button); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active); gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (button)); }
static gboolean gdict_applet_entry_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data) { GdictAppletPrivate *priv = GDICT_APPLET (user_data)->priv; if (event->keyval == GDK_KEY_Escape) { if (priv->is_window_showing) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->toggle), FALSE); gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (priv->toggle)); return TRUE; } } else if (event->keyval == GDK_KEY_Tab) { if (priv->is_window_showing) gtk_widget_grab_focus (priv->defbox); } return FALSE; }
void ugtk_schedule_form_set (struct UgtkScheduleForm* sform, UgtkSetting* setting) { // gint value; memcpy (sform->state, setting->scheduler.state.at, sizeof (sform->state)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sform->enable), setting->scheduler.enable); gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (sform->enable)); // value = setting->scheduler.speed_limit / 1024; // gtk_spin_button_set_value (sform->spin_speed, value); }
void sp_find_dialog_reset (GObject *, GObject *dlg) { sp_find_reset_searchfield (dlg, "text"); sp_find_reset_searchfield (dlg, "id"); sp_find_reset_searchfield (dlg, "style"); sp_find_reset_searchfield (dlg, "attr"); GtkWidget *types = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (dlg), "types")); GtkToggleButton *tb = GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (types), "all")); gtk_toggle_button_toggled (tb); gtk_toggle_button_set_active (tb, TRUE); }
void toggle_alltypes (GtkToggleButton *tb, gpointer data) { GtkWidget *alltypes_pane = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (data), "all-pane")); if (gtk_toggle_button_get_active (tb)) { gtk_widget_hide_all (alltypes_pane); } else { gtk_widget_show_all (alltypes_pane); // excplicit toggle to make sure its handler gets called, no matter what was the original state gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (data), "shapes"))); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (data), "shapes")), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (data), "paths")), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (data), "texts")), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (data), "groups")), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (data), "clones")), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (data), "images")), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (data), "offsets")), TRUE); } sp_find_squeeze_window(); }
static gboolean window_key_press_event_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data) { GdictApplet *applet = GDICT_APPLET (user_data); if (event->keyval == GDK_KEY_Escape) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (applet->priv->toggle), FALSE); gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (applet->priv->toggle)); return TRUE; } else if ((event->keyval == GDK_KEY_l) && (event->state & GDK_CONTROL_MASK)) { gtk_widget_grab_focus (applet->priv->entry); return TRUE; } return FALSE; }
/*! \brief populate_dlog_choices_pf() is called when the datalogging tab is loaded by glade AFTER the realtime variable definitions have been loaded and processed. All of the logable variables are then placed here for user selecting during datalogging. */ G_MODULE_EXPORT void populate_dlog_choices(void) { guint i,j,k; GList *list = NULL; GtkWidget *vbox = NULL; GtkWidget *table = NULL; GtkWidget *button = NULL; GtkWidget *label = NULL; gint table_rows = 0; gconstpointer * object = NULL; gchar * dlog_name = NULL; gchar * tooltip = NULL; Rtv_Map *rtv_map = NULL; ENTER(); rtv_map = (Rtv_Map *)DATA_GET(global_data,"rtv_map"); if (DATA_GET(global_data,"leaving")) { EXIT(); return; } if (!((DATA_GET(global_data,"connected")) && (DATA_GET(global_data,"interrogated")))) { EXIT(); return; } if (!DATA_GET(global_data,"rtvars_loaded")) { MTXDBG(CRITICAL,_("CRITICAL ERROR, Realtime Variable definitions are NOT LOADED!!!\n")); EXIT(); return; } set_title(g_strdup(_("Populating Datalogger..."))); vbox = lookup_widget("dlog_logable_vars_vbox1"); if (!GTK_IS_WIDGET(vbox)) { printf(_("datalogger windows not present, returning\n")); EXIT(); return; } table_rows = ceil((float)rtv_map->derived_total/(float)TABLE_COLS); table = gtk_table_new(table_rows,TABLE_COLS,FALSE); gtk_table_set_row_spacings(GTK_TABLE(table),0); gtk_table_set_col_spacings(GTK_TABLE(table),0); gtk_container_set_border_width(GTK_CONTAINER(table),0); gtk_box_pack_start(GTK_BOX(vbox),table,TRUE,TRUE,0); /* Update status of the delimiter buttons... */ switch ((GINT)DATA_GET(global_data,"preferred_delimiter")) { case COMMA: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget("dlog_comma_delimit_radio_button")),TRUE); gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(lookup_widget("dlog_comma_delimit_radio_button"))); break; case TAB: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget("dlog_tab_delimit_radio_button")),TRUE); gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(lookup_widget("dlog_tab_delimit_radio_button"))); break; default: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget("dlog_comma_delimit_radio_button")),TRUE); gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(lookup_widget("dlog_comma_delimit_radio_button"))); break; } j = 0; k = 0; /* Put into GList and sort it */ for (i=0;i<rtv_map->derived_total;i++) list = g_list_prepend(list,(gpointer)g_ptr_array_index(rtv_map->rtv_list,i)); list = g_list_sort_with_data(list,list_object_sort,(gpointer)"dlog_gui_name"); for (i=0;i<rtv_map->derived_total;i++) { tooltip = NULL; dlog_name = NULL; //object = g_ptr_array_index(rtv_map->rtv_list,i); object = (gconstpointer *)g_list_nth_data(list,i); dlog_name = (gchar *)DATA_GET(object,"dlog_gui_name"); button = gtk_check_button_new(); label = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(label),dlog_name); gtk_container_add(GTK_CONTAINER(button),label); tooltip = (gchar *)(DATA_GET(object,"tooltip")); if (tooltip) gtk_widget_set_tooltip_text(button,tooltip); /* Bind button to the object, Done so that we can set the state * of the buttons from elsewhere... */ DATA_SET(object,"dlog_button",(gpointer)button); /* Bind object to the button */ OBJ_SET(button,"object",(gpointer)object); g_signal_connect(G_OBJECT(button),"toggled", G_CALLBACK(log_value_set), NULL); if ((GINT)DATA_GET(object,"log_by_default") == 1) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_table_attach (GTK_TABLE (table), button, j, j+1, k, k+1, (GtkAttachOptions) (GTK_EXPAND|GTK_FILL|GTK_SHRINK), (GtkAttachOptions) (GTK_FILL|GTK_SHRINK), //(GtkAttachOptions) (GTK_FILL|GTK_SHRINK), //(GtkAttachOptions) (GTK_FILL|GTK_SHRINK), 0, 0); j++; if (j == TABLE_COLS) { k++; j = 0; } } g_list_free(list); gtk_widget_show_all(vbox); set_title(g_strdup(_("Datalogger Ready..."))); EXIT(); return; }
static VALUE tbtn_toggled(VALUE self) { gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(RVAL2GOBJ(self))); return self; }
void ugtk_schedule_form_init (struct UgtkScheduleForm* sform) { GtkWidget* widget; GtkGrid* caption; GtkBox* hbox; GtkBox* vbox; sform->self = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); vbox = (GtkBox*) sform->self; // Enable Scheduler hbox = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (vbox, (GtkWidget*)hbox, FALSE, FALSE, 2); widget = gtk_check_button_new_with_mnemonic (_("_Enable Scheduler")); gtk_box_pack_start (hbox, widget, FALSE, FALSE, 2); gtk_box_pack_start (hbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), TRUE, TRUE, 2); g_signal_connect (widget, "toggled", G_CALLBACK (on_enable_toggled), sform); sform->enable = widget; // drawing area widget = gtk_drawing_area_new (); gtk_box_pack_start (vbox, widget, FALSE, FALSE, 2); // gtk_widget_set_has_window (widget, FALSE); gtk_widget_set_size_request (widget, GRID_WIDTH_ALL + 32, GRID_HEIGHT_ALL); gtk_widget_add_events (widget, GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); g_signal_connect (widget, "draw", G_CALLBACK (on_draw_callback), sform); g_signal_connect (widget, "button-press-event", G_CALLBACK (on_button_press_event), sform); g_signal_connect (widget, "motion-notify-event", G_CALLBACK (on_motion_notify_event), sform); g_signal_connect (widget, "leave-notify-event", G_CALLBACK (on_leave_notify_event), sform); sform->drawing = widget; // grid for tips, SpinButton sform->caption = gtk_grid_new (); gtk_box_pack_start (vbox, sform->caption, FALSE, FALSE, 2); // gtk_container_set_border_width (GTK_CONTAINER (sform->caption), 10); caption = (GtkGrid*) sform->caption; // time tips widget = gtk_label_new (""); gtk_misc_set_alignment (GTK_MISC (widget), (gfloat)0.4, (gfloat)0.5); // left, center g_object_set (widget, "margin", 2, NULL); gtk_grid_attach (caption, widget, 0, 0, 5, 1); sform->time_tips = GTK_LABEL (widget); // Turn off - gridone widget = ug_grid_one_new (colors[UGTK_SCHEDULE_TURN_OFF]); g_object_set (widget, "margin", 3, NULL); gtk_grid_attach (caption, widget, 0, 1, 1, 1); // Turn off - label widget = gtk_label_new (_("Turn off")); gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); // left, center g_object_set (widget, "margin", 2, NULL); gtk_grid_attach (caption, widget, 1, 1, 1, 1); // Turn off - help label widget = gtk_label_new (_("- stop all task")); gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); // left, center g_object_set (widget, "margin", 2, NULL); gtk_grid_attach (caption, widget, 2, 1, 2, 1); // Normal - gridone widget = ug_grid_one_new (colors[UGTK_SCHEDULE_NORMAL]); g_object_set (widget, "margin", 3, NULL); gtk_grid_attach (caption, widget, 0, 2, 1, 1); // Normal - label widget = gtk_label_new (_("Normal")); gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); // left, center g_object_set (widget, "margin", 2, NULL); gtk_grid_attach (caption, widget, 1, 2, 1, 1); // Normal - help label widget = gtk_label_new (_("- run task normally")); gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); // left, center g_object_set (widget, "margin", 2, NULL); gtk_grid_attach (caption, widget, 2, 2, 2, 1); /* // Speed limit - gridone widget = ug_grid_one_new (colors[UGTK_SCHEDULE_LIMITED_SPEED]); g_object_set (widget, "margin", 3, NULL); gtk_grid_attach (caption, widget, 0, 3, 1, 1); // Speed limit - label widget = gtk_label_new (_("Limited speed")); gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); // left, center g_object_set (widget, "margin", 2, NULL); gtk_grid_attach (caption, widget, 1, 3, 1, 1); // Speed limit - SpinButton widget = gtk_spin_button_new_with_range (5, 99999999, 1); g_object_set (widget, "margin", 2, NULL); gtk_grid_attach (caption, widget, 2, 3, 1, 1); sform->spin_speed = (GtkSpinButton*) widget; // Speed limit - KiB/s label widget = gtk_label_new (_("KiB/s")); gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); // left, center g_object_set (widget, "margin", 2, NULL); gtk_grid_attach (caption, widget, 3, 3, 1, 1); */ // change sensitive state gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sform->enable), FALSE); gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (sform->enable)); gtk_widget_show_all (sform->self); }
/*! \brief personality_choice() is called from a one shot timeout from main in order to open the window to ask the user what ECU family to deal with running. */ G_MODULE_EXPORT gboolean personality_choice(void) { GtkWidget *dialog = NULL; GtkWidget *vbox = NULL; GtkWidget *hbox = NULL; GtkWidget *ebox = NULL; GtkWidget *sep = NULL; GtkWidget *button = NULL; GtkWidget *label = NULL; gchar ** dirs = NULL; gchar * filename = NULL; PersonaElement *element = NULL; gchar *tmpbuf = NULL; gboolean shouldjump = FALSE; gchar *name = NULL; GArray *classes = NULL; GSList *group = NULL; GList *p_list = NULL; GList *s_list = NULL; ConfigFile *cfgfile = NULL; guint i = 0; gint result = 0; gchar * pathstub = NULL; extern gconstpointer *global_data; pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",NULL); dirs = get_dirs((const gchar *)DATA_GET(global_data,"project_name"),pathstub,&classes); if (!dirs) { MTXDBG(CRITICAL,_("NO Interrogation profiles found, was MegaTunix installed properly?\n")); return FALSE; } i = 0; while (dirs[i]) { tmpbuf = g_build_filename(dirs[i],"details.cfg",NULL); cfgfile = cfg_open_file(tmpbuf); if (!cfgfile) { /*MTXDBG(CRITICAL,_("\"%s\" file missing!, was MegaTunix installed properly?\n"),tmpbuf);*/ i++; g_free(tmpbuf); continue; } g_free(tmpbuf); element = g_new0(PersonaElement, 1); cfg_read_string(cfgfile,"Family","sequence",&element->sequence); cfg_read_string(cfgfile,"Family","friendly_name",&element->name); cfg_read_string(cfgfile,"Family","persona",&element->persona); cfg_read_string(cfgfile,"Family","ecu_lib",&element->ecu_lib); cfg_read_string(cfgfile,"Family","common_lib",&element->common_lib); if (!cfg_read_string(cfgfile,"Family","baud",&element->baud_str)) MTXDBG(CRITICAL,_("\"details.cfg\" baud string undefined!, was MegaTunix installed properly?\n")); element->dirname = g_strdup(dirs[i]); element->filename = g_path_get_basename(dirs[i]); if (g_strcasecmp(element->filename,(gchar *)DATA_GET(global_data,"last_ecu_family")) == 0) element->def = TRUE; if ((DATA_GET(global_data,"cli_persona")) && (element->persona)) { if (g_strcasecmp(element->persona, (gchar *)DATA_GET(global_data,"cli_persona")) == 0) { button = gtk_toggle_button_new(); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE); persona_selection(button,(gpointer)element); g_object_ref_sink(button); g_object_unref(button); shouldjump = TRUE; } } if (g_array_index(classes,FileClass,i) == PERSONAL) p_list = g_list_prepend(p_list,(gpointer)element); if (g_array_index(classes,FileClass,i) == SYSTEM) s_list = g_list_prepend(s_list,(gpointer)element); g_free(name); i++; cfg_free(cfgfile); } p_list = g_list_sort(p_list,persona_seq_sort); s_list = g_list_sort(s_list,persona_seq_sort); g_strfreev(dirs); g_array_free(classes,TRUE); if (shouldjump) { g_list_foreach(p_list,free_persona_element,NULL); g_list_foreach(s_list,free_persona_element,NULL); g_list_free(p_list); g_list_free(s_list); DATA_SET(global_data,"cli_persona",NULL); if (DATA_GET(global_data,"offline")) goto jumpahead_offline; else goto jumpahead; } set_title(g_strdup(_("Choose an ECU family?"))); update_logbar("interr_view","warning",_("Prompting user for ECU family to interrogate...\n"),FALSE,FALSE,FALSE); dialog = gtk_dialog_new_with_buttons("Select ECU Personality", GTK_WINDOW(lookup_widget("main_window")), GTK_DIALOG_DESTROY_WITH_PARENT, "Exit MegaTunix", GTK_RESPONSE_CLOSE, "Go Offline", GTK_RESPONSE_CANCEL, "Find my ECU", GTK_RESPONSE_OK, NULL); vbox = gtk_vbox_new(TRUE,2); gtk_container_set_border_width(GTK_CONTAINER(vbox),5); //gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),vbox,TRUE,TRUE,0); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),vbox,TRUE,TRUE,0); if (g_list_length(p_list) > 0) { label = gtk_label_new("Custom (personal) Profiles"); gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,0); group = NULL; /* Cycle list for PERSONAL profile files */ for (i=0;i<g_list_length(p_list);i++) { element = (PersonaElement *)g_list_nth_data(p_list,i); ebox = gtk_event_box_new(); gtk_box_pack_start(GTK_BOX(vbox),ebox,TRUE,TRUE,0); hbox = gtk_hbox_new(FALSE,10); gtk_container_add(GTK_CONTAINER(ebox),hbox); label = gtk_label_new(element->name); gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,TRUE,0); if (!check_for_files (element->dirname,"prof")) { gtk_widget_set_sensitive(ebox,FALSE); button = gtk_radio_button_new(NULL); } else { button = gtk_radio_button_new(group); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button)); } g_signal_connect(button, "toggled", G_CALLBACK(persona_selection), element); gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,TRUE,0); if (element->def) { gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE); gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(button)); } } sep = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(vbox),sep,TRUE,TRUE,0); } label = gtk_label_new("System Wide ECU Profiles"); gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,0); /* Cycle list for System interogation files */ for (i=0;i<g_list_length(s_list);i++) { element = (PersonaElement *)g_list_nth_data(s_list,i); ebox = gtk_event_box_new(); gtk_box_pack_start(GTK_BOX(vbox),ebox,TRUE,TRUE,0); hbox = gtk_hbox_new(FALSE,10); gtk_container_add(GTK_CONTAINER(ebox),hbox); label = gtk_label_new(element->name); gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,TRUE,0); if (!check_for_files (element->dirname,"prof")) { gtk_widget_set_sensitive(ebox,FALSE); button = gtk_radio_button_new(NULL); } else { button = gtk_radio_button_new(group); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button)); } g_signal_connect(button, "toggled", G_CALLBACK(persona_selection), element); gtk_box_pack_end(GTK_BOX(hbox),button,FALSE,TRUE,0); if (element->def) { gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button),TRUE); gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(button)); } } gtk_widget_show_all(dialog); result = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); g_list_foreach(p_list,free_persona_element,NULL); g_list_foreach(s_list,free_persona_element,NULL); g_list_free(p_list); g_list_free(s_list); switch (result) { case GTK_RESPONSE_CLOSE: leave(NULL,NULL); break; case GTK_RESPONSE_ACCEPT: case GTK_RESPONSE_OK: /* Normal mode */ jumpahead: plugins_init(); pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",DATA_GET(global_data,"ecu_family"),"comm.xml",NULL); filename = get_file((const gchar *)DATA_GET(global_data,"project_name"),pathstub,NULL); g_free(pathstub); load_comm_xml(filename); g_free(filename); io_cmd("interrogation",NULL); break; default: /* Offline */ jumpahead_offline: plugins_init(); pathstub = g_build_filename(INTERROGATOR_DATA_DIR,"Profiles",DATA_GET(global_data,"ecu_family"),"comm.xml",NULL); filename = get_file((const gchar *)DATA_GET(global_data,"project_name"),pathstub,NULL); g_free(pathstub); load_comm_xml(filename); g_free(filename); g_timeout_add(100,(GSourceFunc)set_offline_mode,NULL); return FALSE; } return FALSE; }
static void gtk_mount_operation_ask_password (GMountOperation *mount_op, const char *message, const char *default_user, const char *default_domain, GAskPasswordFlags flags) { GtkMountOperation *operation; GtkMountOperationPrivate *priv; GtkWidget *widget; GtkDialog *dialog; GtkWindow *window; GtkWidget *entry_container; GtkWidget *hbox, *main_vbox, *vbox, *icon; GtkWidget *table; GtkWidget *message_label; gboolean can_anonymous; guint rows; operation = GTK_MOUNT_OPERATION (mount_op); priv = operation->priv; priv->ask_flags = flags; widget = gtk_dialog_new (); dialog = GTK_DIALOG (widget); window = GTK_WINDOW (widget); priv->dialog = dialog; /* Set the dialog up with HIG properties */ gtk_dialog_set_has_separator (dialog, FALSE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5); gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6); gtk_window_set_resizable (window, FALSE); gtk_window_set_title (window, ""); gtk_window_set_icon_name (window, GTK_STOCK_DIALOG_AUTHENTICATION); gtk_dialog_add_buttons (dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("Co_nnect"), GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK); gtk_dialog_set_alternative_button_order (dialog, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); /* Build contents */ hbox = gtk_hbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox, TRUE, TRUE, 0); icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0.0); gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0); main_vbox = gtk_vbox_new (FALSE, 18); gtk_box_pack_start (GTK_BOX (hbox), main_vbox, TRUE, TRUE, 0); message_label = gtk_label_new (message); gtk_misc_set_alignment (GTK_MISC (message_label), 0.0, 0.5); gtk_label_set_line_wrap (GTK_LABEL (message_label), TRUE); gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (message_label), FALSE, FALSE, 0); vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); can_anonymous = flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED; if (can_anonymous) { GtkWidget *anon_box; GtkWidget *choice; GSList *group; anon_box = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (vbox), anon_box, FALSE, FALSE, 0); choice = gtk_radio_button_new_with_mnemonic (NULL, _("Connect _anonymously")); gtk_box_pack_start (GTK_BOX (anon_box), choice, FALSE, FALSE, 0); g_signal_connect (choice, "toggled", G_CALLBACK (pw_dialog_anonymous_toggled), operation); priv->anonymous_toggle = choice; group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice)); choice = gtk_radio_button_new_with_mnemonic (group, _("Connect as u_ser:")); gtk_box_pack_start (GTK_BOX (anon_box), choice, FALSE, FALSE, 0); g_signal_connect (choice, "toggled", G_CALLBACK (pw_dialog_anonymous_toggled), operation); } rows = 0; if (flags & G_ASK_PASSWORD_NEED_PASSWORD) rows++; if (flags & G_ASK_PASSWORD_NEED_USERNAME) rows++; if (flags &G_ASK_PASSWORD_NEED_DOMAIN) rows++; /* The table that holds the entries */ entry_container = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); gtk_alignment_set_padding (GTK_ALIGNMENT (entry_container), 0, 0, can_anonymous ? 12 : 0, 0); gtk_box_pack_start (GTK_BOX (vbox), entry_container, FALSE, FALSE, 0); priv->entry_container = entry_container; table = gtk_table_new (rows, 2, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 12); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_container_add (GTK_CONTAINER (entry_container), table); rows = 0; if (flags & G_ASK_PASSWORD_NEED_USERNAME) priv->username_entry = table_add_entry (table, rows++, _("_Username:"******"_Domain:"), default_domain, operation); if (flags & G_ASK_PASSWORD_NEED_PASSWORD) { priv->password_entry = table_add_entry (table, rows++, _("_Password:"******"Forget password _immediately")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (choice), password_save == G_PASSWORD_SAVE_NEVER); g_object_set_data (G_OBJECT (choice), "password-save", GINT_TO_POINTER (G_PASSWORD_SAVE_NEVER)); g_signal_connect (choice, "toggled", G_CALLBACK (remember_button_toggled), operation); gtk_box_pack_start (GTK_BOX (remember_box), choice, FALSE, FALSE, 0); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice)); choice = gtk_radio_button_new_with_mnemonic (group, _("Remember password until you _logout")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (choice), password_save == G_PASSWORD_SAVE_FOR_SESSION); g_object_set_data (G_OBJECT (choice), "password-save", GINT_TO_POINTER (G_PASSWORD_SAVE_FOR_SESSION)); g_signal_connect (choice, "toggled", G_CALLBACK (remember_button_toggled), operation); gtk_box_pack_start (GTK_BOX (remember_box), choice, FALSE, FALSE, 0); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice)); choice = gtk_radio_button_new_with_mnemonic (group, _("Remember _forever")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (choice), password_save == G_PASSWORD_SAVE_PERMANENTLY); g_object_set_data (G_OBJECT (choice), "password-save", GINT_TO_POINTER (G_PASSWORD_SAVE_PERMANENTLY)); g_signal_connect (choice, "toggled", G_CALLBACK (remember_button_toggled), operation); gtk_box_pack_start (GTK_BOX (remember_box), choice, FALSE, FALSE, 0); } g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (pw_dialog_got_response), operation); if (can_anonymous) { /* The anonymous option will be active by default, * ensure the toggled signal is emitted for it. */ gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (priv->anonymous_toggle)); } else if (! pw_dialog_input_is_valid (operation)) gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, FALSE); g_object_notify (G_OBJECT (operation), "is-showing"); if (priv->parent_window) { gtk_window_set_transient_for (window, priv->parent_window); gtk_window_set_modal (window, TRUE); } else if (priv->screen) gtk_window_set_screen (GTK_WINDOW (dialog), priv->screen); gtk_widget_show_all (GTK_WIDGET (dialog)); g_object_ref (operation); }
static VALUE rg_toggled(VALUE self) { gtk_toggle_button_toggled(RVAL2GTKTOGGLEBUTTON(self)); return self; }
/** * Propagates the activate signal on mute_item (GtkMenuItem) in the right-click * popup menu to the underlying mute_check_popup_menu (GtkCheckButton) as * toggled signal. */ void on_mute_item_clicked(void) { gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(mute_check_popup_window)); }