示例#1
0
/* Set items in the key_array and value_array to GtkComboBox */
void SetTextArrayToComboBox(GtkWidget* window, gchar *combo_name,
		const gchar* key_array[], const short value_array[], short value)
{
	int index = 0;
	int i;

	GtkWidget* combo = LookupWidget(window, combo_name);

	/* Remove all items in current list */
	if(gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ){
		while( 1 ){
			gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 );
			if( ! gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ) break;
			gtk_combo_box_remove_text( GTK_COMBO_BOX( combo ), 0 );
		}
	}

	/* Add items in "key_array" */
	for( i = 0 ; key_array[i] != NULL ; i++ )
	{
		gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), LookupText(g_keytext_list, key_array[i]) );
		if( value_array[i] == value ) index = i;
	}

	/* Set active item */
	gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), index );
}
static void GetParmSetConfigType001_AutoPowerType( int uiType, GtkButton *button )
{
	GtkWidget *onCombo, *offCombo;
	gchar *onStr, *offStr;
	short onSize, offSize;

	onCombo = LookupWidget( GTK_WIDGET(button), "setconfig_type001_combobox201" );
	offCombo = LookupWidget( GTK_WIDGET(button), "setconfig_type001_combobox202" );

	onStr = gtk_combo_box_get_active_text(GTK_COMBO_BOX(onCombo));
	offStr = gtk_combo_box_get_active_text(GTK_COMBO_BOX(offCombo));


	if ( uiType == UI_AUTOPOWER_TYPE001 ){
		onSize = sizeof(setconfig_type001_02_onlist)/sizeof(*setconfig_type001_02_onlist);
		offSize = sizeof(setconfig_type001_02_offlist)/sizeof(*setconfig_type001_02_offlist);

		gCurrentAutoPowerOnIndex = GetAutoPowerIndex( setconfig_type001_02_onlist, onSize, onStr );
		gCurrentAutoPowerOffIndex = GetAutoPowerIndex( setconfig_type001_02_offlist, offSize, offStr );
	}
	else if ( uiType == UI_AUTOPOWER_TYPE002 ){
		onSize = sizeof(setconfig_type001_02_onlist)/sizeof(*setconfig_type001_02_onlist);
		offSize = sizeof(setconfig_type001_03list)/sizeof(*setconfig_type001_03list);

		gCurrentAutoPowerOnIndex = GetAutoPowerIndex( setconfig_type001_02_onlist, onSize, onStr );
		gCurrentAutoPowerOffIndex = GetAutoPowerIndex( setconfig_type001_03list, offSize, offStr );
	}
	
}
void maskTypeChangedCallback(GtkComboBox *widget, PlugInVals *vals) {
#ifdef DEBUG
	g_warning("maskTypeChangedCallback");
#endif
	if (g_ascii_strncasecmp(gtk_combo_box_get_active_text(widget),
							"Selection",9)==0) {
		gtk_widget_set_sensitive(interface_vals.mask_combo_widget,FALSE);
		interface_vals.mask_type = SELECTION;
		if (g_ascii_strncasecmp(gtk_combo_box_get_active_text(widget) + 9,
									" With Stop Path",15)==0) {
			gtk_widget_set_sensitive(interface_vals.stop_path_combo_widget,TRUE);
		} else {
			gtk_widget_set_sensitive(interface_vals.stop_path_combo_widget,FALSE);

		}
	} else {
		gtk_widget_set_sensitive(interface_vals.mask_combo_widget,TRUE);
		if (g_ascii_strncasecmp(gtk_combo_box_get_active_text(widget),
									"Binary Mask",11)==0) {
			interface_vals.mask_type = BINARY_MASK;
			if (g_ascii_strncasecmp(gtk_combo_box_get_active_text(widget) + 11,
					" With Stop Path",15)==0) {
				gtk_widget_set_sensitive(interface_vals.stop_path_combo_widget,TRUE);
			} else {
				gtk_widget_set_sensitive(interface_vals.stop_path_combo_widget,FALSE);
			}
		} else {
			interface_vals.mask_type = ORDER_MASK;
		}

	}

	dialogMaskChangedCallback(interface_vals.mask_combo_widget, vals);
	dialogStopPathChangedCallback(interface_vals.stop_path_combo_widget, vals);
}
示例#4
0
/* item value(nValue) -> combo index */
short ValueToComboIndex( GtkWidget *combo , short object , short target_value ) //nValueで指定
{
	short result = -1;
	short item_count = 0;
	char *combo_item_name = NULL;
	short combo_item_value = -1;

	// search in the list of the combo
	if(gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ){
	
		while( 1 ){
			gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), item_count );
			combo_item_name = (char*)gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
			if( ! combo_item_name ) break;

			combo_item_value = NameToValue( object, combo_item_name );	/* convert name(string) to CNCLID */

			if( combo_item_value == target_value ){
				result = item_count;
				break;
			}
			item_count++;
		}
	}

	return result;
}
示例#5
0
文件: uilogin.c 项目: gqqDev/gkiu
/**
   on_btn_login_clicked: 
   @widget: The widget.
   @data: user data.
   btn_login (signal) clicked callback
 */
static void
on_btn_login_clicked(GtkWidget *widget,
                     gpointer data)
{
	/* Add the current user to list */
	cfg_add_user_to_list (gtk_combo_box_get_active_text (GTK_COMBO_BOX (cbb_usr)));
	
	/* TODO: 这里暂未考虑已存储的密码 */
	gboolean save_pwd = FALSE;
	GString *user = g_string_new (gtk_combo_box_get_active_text (GTK_COMBO_BOX (cbb_usr)));
	
	cfg_chkusrdir (user->str);
	
	save_pwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chb_svpwd));
	if (save_pwd == TRUE)
	{
	  //dbg_print ("DBG: Will save the password.");
		keyring_savepwd (user->str,gtk_entry_get_text (GTK_ENTRY (ety_pwd)));
	}
	/* WILL BE MOVE *//*
	keyring_findpwd (user->str,&pwd);

	keyring_delpwd (user->str);
	g_string_free (user, TRUE);*/
}
示例#6
0
/* item strings(UI name) -> combo index */
short NameToComboIndex( GtkWidget *combo , gchar *target_name )
{
	short result = -1;
	short item_count = 0;
	char *combo_item_name = NULL;

	// search in the list of the combo
	if(gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ){
	
		while( 1 ){
			gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), item_count );

			combo_item_name = (char*)gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
			if( ! combo_item_name ) break;

			if( !strcmp( combo_item_name , target_name )){
				result = item_count;
				break;
			}
			item_count++;
		}
	}

	return result;
}
示例#7
0
文件: metadata.c 项目: sk1p/darktable
static void write_metadata(dt_lib_module_t *self)
{
  dt_lib_metadata_t *d  = (dt_lib_metadata_t *)self->data;

  gchar *title       = gtk_combo_box_get_active_text(GTK_COMBO_BOX(d->title));
  gchar *description = gtk_combo_box_get_active_text(GTK_COMBO_BOX(d->description));
  gchar *rights      = gtk_combo_box_get_active_text(GTK_COMBO_BOX(d->rights));
  gchar *creator     = gtk_combo_box_get_active_text(GTK_COMBO_BOX(d->creator));
  gchar *publisher   = gtk_combo_box_get_active_text(GTK_COMBO_BOX(d->publisher));

  if(title != NULL && (d->multi_title == FALSE || gtk_combo_box_get_active(GTK_COMBO_BOX(d->title)) != 0))
    dt_metadata_set(-1, "Xmp.dc.title", title);
  if(description != NULL && (d->multi_description == FALSE || gtk_combo_box_get_active(GTK_COMBO_BOX(d->description)) != 0))
    dt_metadata_set(-1, "Xmp.dc.description", description);
  if(rights != NULL && (d->multi_rights == FALSE || gtk_combo_box_get_active(GTK_COMBO_BOX(d->rights)) != 0))
    dt_metadata_set(-1, "Xmp.dc.rights", rights);
  if(creator != NULL && (d->multi_creator == FALSE || gtk_combo_box_get_active(GTK_COMBO_BOX(d->creator)) != 0))
    dt_metadata_set(-1, "Xmp.dc.creator", creator);
  if(publisher != NULL && (d->multi_publisher == FALSE || gtk_combo_box_get_active(GTK_COMBO_BOX(d->publisher)) != 0))
    dt_metadata_set(-1, "Xmp.dc.publisher", publisher);

  if(title != NULL)
    g_free(title);
  if(description != NULL)
    g_free(description);
  if(rights != NULL)
    g_free(rights);
  if(creator != NULL)
    g_free(creator);
  if(publisher != NULL)
    g_free(publisher);

  dt_image_synch_xmp(-1);
  update(self, FALSE);
}
示例#8
0
gboolean
parse_user_data(GtkWidget *widget, gpointer gdata) {
    Data *data = (Data *) gdata;


    if (!gtk_entry_get_text_length(GTK_ENTRY(data->player1Entry)) ||
            !gtk_entry_get_text_length(GTK_ENTRY(data->player2Entry))) {
        GdkColor *baseColor = (GdkColor *) calloc(1, sizeof (GdkColor)),
                *textColor = (GdkColor *) calloc(1, sizeof (GdkColor));
        gdk_color_parse(INVALID_BASE_COLOR, baseColor);
        gdk_color_parse(INVALID_TEXT_COLOR, textColor);
        if (!gtk_entry_get_text_length(GTK_ENTRY(data->player1Entry))) {
            gtk_widget_modify_base((data->player1Entry), GTK_STATE_NORMAL,
                    baseColor);
            gtk_widget_modify_text((data->player1Entry), GTK_STATE_NORMAL,
                    textColor);
            gtk_entry_set_text(GTK_ENTRY(data->player1Entry), "Invalid Name");
        }
        if (!gtk_entry_get_text_length(GTK_ENTRY(data->player2Entry))) {
            gtk_widget_modify_base((data->player2Entry), GTK_STATE_NORMAL,
                    baseColor);
            gtk_widget_modify_text((data->player2Entry), GTK_STATE_NORMAL,
                    textColor);
            gtk_entry_set_text(GTK_ENTRY(data->player2Entry), "Invalid Name");
        }
        free(baseColor);
        free(textColor);
        return FALSE;
    }
    strcpy(data->player1Name, (const char *) gtk_entry_get_text(GTK_ENTRY
            (data->player1Entry)));
    strcpy(data->player2Name, (const char *) gtk_entry_get_text(GTK_ENTRY
            (data->player2Entry)));

    if (!strcmp(data->player1Name, "Invalid Name") ||
            !strcmp(data->player2Name, "Invalid Name"))
        return FALSE;
    if (!strcmp(data->player1Name, data->player2Name)) {
        strcat(data->player1Name, " (Player 1)");
        strcat(data->player2Name, " (Player 2)");
    }
    data->horizontalLines = atoi((char *) gtk_combo_box_get_active_text
            (GTK_COMBO_BOX(data->comboBoxHorizontal)));
    data->verticalLines = atoi((char *) gtk_combo_box_get_active_text
            (GTK_COMBO_BOX(data->comboBoxVertical)));
    data->opponent = (GTK_TOGGLE_BUTTON(data->radioButtonComputer))->active ?
            COMPUTER : HUMAN;
    if (data->opponent == COMPUTER) {
        char *diff;
        diff = gtk_combo_box_get_active_text(GTK_COMBO_BOX(data->difficulty_combo));
        if (!strcmp(diff, "Easy"))
            data->difficulty = easy;
        else if (!strcmp(diff, "Medium"))
            data->difficulty = medium;
        else data->difficulty = hard;
    }
    gtk_main_quit();
    return TRUE;
}
示例#9
0
文件: modif.c 项目: zizoumgs/Aman
//! ketika tombol add di tekan maka akan kesini
gboolean modifAdd(gpointer call,GtkWidget* parent){
	gboolean status = FALSE;
	//modifGetWidgetLama(parent);
	modifStruct_ *modif = struct_new(modifStruct_);
	GtkWidget *w = modifGetDialogWithStruct(parent , modif ,"Menambah Data");	
	gtk_widget_show_all(w);
	gint result = gtk_dialog_run ((GtkDialog *) w);	// block
	if (result==GTK_RESPONSE_OK){
		//! mencari total row
		const gchar *exe = "select max(id) from isi ";
		databaseExe(exe);
		char **data = databaseGetData();
		int totalRow = databaseGetTotalRow();
		databaseFreeData();		
		//! mengambil data
		char *filename;
		char* jamchar = globalPutZeroToWkt(gtk_spin_button_get_value_as_int((GtkSpinButton *) modif->jam));
		char* mntchar = globalPutZeroToWkt(gtk_spin_button_get_value_as_int((GtkSpinButton *) modif->mnt));		
		gchar *jamMnt	= g_strdup_printf ("%s:%s", jamchar,mntchar);
		gchar * hari 	= gtk_combo_box_get_active_text ( (GtkComboBox *) modif->hari);
		gchar * bagian 	= gtk_combo_box_get_active_text ( (GtkComboBox *) modif->bagian );
		gint	total   = gtk_spin_button_get_value_as_int ( (GtkSpinButton *) modif->total);
		filename = fuGetNameFile( gtk_button_get_label( (GtkButton *) modif->filePilih));
		//! insert into database
		gint idHari = databaseGetIdHari(hari);
		GValueArray* varr = 	g_value_array_new (-1);		
		GValue a = {0};
		g_assert (!G_VALUE_HOLDS_STRING (&a));			
		g_value_init (&a, G_TYPE_INT);
		g_value_set_int (&a, totalRow+1);		//! 1
		varr =	g_value_array_append(varr,&a);								
		g_value_set_int (&a, idHari);			//! 2
		varr =	g_value_array_append(varr,&a);
		g_value_set_int (&a, total);			//! 3
		varr =	g_value_array_append(varr,&a);
		g_value_unset (&a);
		g_value_init (&a, G_TYPE_STRING);
		g_value_set_string (&a, jamMnt);		//! 4
		varr =	g_value_array_append(varr,&a);								
		g_value_set_string (&a, bagian);		//! 5
		varr =	g_value_array_append(varr,&a);								
		g_value_set_string (&a, filename);		//! 6
		varr =	g_value_array_append(varr,&a);

		GValueArray *hasil = databaseGetDatasFromDb("insert into isi (id,dal,X,jam,bagian,alarm) values (?,?,?,?,?,?)" , varr , &status);
		status = TRUE;
		//! free
		g_value_array_free (varr);
		g_value_array_free (hasil);
		g_free(jamMnt);
		g_free(hari);
		g_free(bagian);
	}
	g_free(modif);
	gtk_widget_destroy(w);
	return status;	
}
示例#10
0
/* Send button */
void
on_setconfig_type001_button1_clicked
                                        (GtkButton       *button,
                                        gpointer         user_data)
{
	LPSETCONFIGCOMPTYPE001WORK lpWk = (LPSETCONFIGCOMPTYPE001WORK)gLPSetConfigWork;
	if ( CheckWorkType001() != 0 ) goto Err;
	GtkWidget* window = GetTopWidget(GTK_WIDGET(button));	
	GtkWidget* check_button = NULL;

	if ( lpWk->uiType == UI_CUSTOMSETTINGS_TYPE001 ){
		/* Abrasion Prevention */
		check_button = LookupWidget( GTK_WIDGET(button), "setconfig_type001_checkbutton1");
		gCurrentAbrasionPrevention =  GTK_TOGGLE_BUTTON(check_button)->active;

		/* Manual Head Alignment */
		check_button = LookupWidget( GTK_WIDGET(button), "setconfig_type001_checkbutton2");
		gCurrentManualHeadMode =  GTK_TOGGLE_BUTTON(check_button)->active;

		/* Dry Level */
		gCurrentDryLevelValue = (short)GetActiveButtonIndex( window, setconfig_type001_radiobutton_name, CUSTOM_SETTINGS_TYPE001_RADIOBUTTON_DEFAULT );
	}
	else if ( lpWk->uiType == UI_AUTOPOWER_TYPE001 ) {
		GtkWidget *onCombo, *offCombo;
		gchar *onStr, *offStr;
		short onSize, offSize;

		onCombo = LookupWidget( GTK_WIDGET(button), "setconfig_type001_combobox201" );
		offCombo = LookupWidget( GTK_WIDGET(button), "setconfig_type001_combobox202" );

		onStr = gtk_combo_box_get_active_text(GTK_COMBO_BOX(onCombo));
		offStr = gtk_combo_box_get_active_text(GTK_COMBO_BOX(offCombo));

		onSize = sizeof(setconfig_type001_02_onlist)/sizeof(*setconfig_type001_02_onlist);
		offSize = sizeof(setconfig_type001_02_offlist)/sizeof(*setconfig_type001_02_offlist);

		gCurrentAutoPowerOnIndex = GetAutoPowerIndex( (char **)setconfig_type001_02_onlist, onSize, onStr );
		gCurrentAutoPowerOffIndex = GetAutoPowerIndex( (char **)setconfig_type001_02_offlist, offSize, offStr );
	}	
	else if ( lpWk->uiType == UI_PAPERSOURCESETTINGS_TYPE001 ) {
		gCurrentPaperSourceSettingsValue = 
			(short)GetActiveButtonIndex( window, setconfig_type001_ps_radiobutton_name, PAPERSOURCE_SETTINGS_TYPE001_RADIOBUTTON_DEFAULT );
	}
	else if ( lpWk->uiType ==  UI_QUIET_TYPE001 ){
		check_button = LookupWidget( GTK_WIDGET(button), "setconfig_type001_checkbutton401");
		gCurrentQuietMode =  GTK_TOGGLE_BUTTON(check_button)->active;
	}

	lpWk->status = US_SEND;
Err:
	gtk_widget_destroy(gtk_widget_get_toplevel(GTK_WIDGET(button)));
}
示例#11
0
void GeCurveGtk::activate_timecombo( GtkWidget *w, gpointer data)
{
  GeCurve *curve = (GeCurve *)data;
  time_ePeriod period;
  gchar *gtext;
  int sts;

  if ( ((GeCurveGtk *)curve)->disable_timecombo_callback)
    return;

  gtext = gtk_combo_box_get_active_text( GTK_COMBO_BOX(((GeCurveGtk *)curve)->timebox_timecombo));
  if ( !gtext)
    return;

  sts = ((GeCurveGtk *)curve)->get_period( &period);
  if ( EVEN(sts)) return;
    
  if ( period == time_ePeriod_UserDefined)
    curve->activate_edit();
  else if ( period == ge_ePeriod_Markers)
    curve->activate_period_markers();
  else
    curve->activate_period( period);
  curve->current_period = period;
}
示例#12
0
/* properties_on_apply */
static void _properties_on_apply(gpointer data)
{
	Properties * properties = data;
	char * p;
	struct group * gr;
	gid_t gid = properties->gid;
	size_t i;
	mode_t mode = 0;

#if GTK_CHECK_VERSION(2, 24, 0)
	p = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(
				properties->group));
#else
	p = gtk_combo_box_get_active_text(GTK_COMBO_BOX(properties->group));
#endif
	if((gr = getgrnam(p)) == NULL)
		_properties_error(properties, p, 1);
	else
		gid = gr->gr_gid;
	for(i = 0; i < 9; i++)
		mode |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
					properties->mode[i])) << i;
	if(lchown(properties->filename, properties->uid, gid) != 0
			|| lchmod(properties->filename, mode) != 0)
		_properties_error(properties, properties->filename, 1);
}
示例#13
0
文件: loginpanel.c 项目: jayivy/gtkqq
const gchar* qq_loginpanel_get_uin(QQLoginPanel *loginpanel)
{
    QQLoginPanel *panel = QQ_LOGINPANEL(loginpanel);
    return gtk_combo_box_get_active_text(
        GTK_COMBO_BOX(panel -> uin_entry));    

}
示例#14
0
/**
 * gpk_prefs_update_combo_changed:
 **/
static void
gpk_prefs_update_combo_changed (GtkWidget *widget, gpointer data)
{
	gchar *value;
	const gchar *action;
	GpkUpdateEnum update = GPK_UPDATE_ENUM_UNKNOWN;
	GConfClient *client;

	client = gconf_client_get_default ();
	value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
	if (value == NULL) {
		egg_warning ("value NULL");
		return;
	}
	if (strcmp (value, PK_UPDATE_ALL_TEXT) == 0) {
		update = GPK_UPDATE_ENUM_ALL;
	} else if (strcmp (value, PK_UPDATE_SECURITY_TEXT) == 0) {
		update = GPK_UPDATE_ENUM_SECURITY;
	} else if (strcmp (value, PK_UPDATE_NONE_TEXT) == 0) {
		update = GPK_UPDATE_ENUM_NONE;
	} else {
		g_assert (FALSE);
	}

	action = gpk_update_enum_to_text (update);
	egg_debug ("Changing %s to %s", GPK_CONF_AUTO_UPDATE, action);
	gconf_client_set_string (client, GPK_CONF_AUTO_UPDATE, action, NULL);
	g_free (value);
	g_object_unref (client);
}
示例#15
0
/**
 * called when the frequency button is changed
 * show/hide the necessary widget according to its state
 *
 * \param combo_box
 *
 * \return FALSE 
 * */
gboolean gsb_form_scheduler_frequency_button_changed ( GtkWidget *combo_box,
						       gpointer null )
{
    gchar *selected_item;

    selected_item = gtk_combo_box_get_active_text ( GTK_COMBO_BOX (combo_box));
    
    if ( !strcmp ( selected_item,
		   _("Once")))
    {
	gtk_widget_hide (gsb_form_scheduler_get_element_widget(SCHEDULED_FORM_LIMIT_DATE));
	gtk_widget_hide (gsb_form_scheduler_get_element_widget(SCHEDULED_FORM_FREQUENCY_USER_ENTRY));
	gtk_widget_hide (gsb_form_scheduler_get_element_widget(SCHEDULED_FORM_FREQUENCY_USER_BUTTON));
    }
    else
    {
	gtk_widget_show (gsb_form_scheduler_get_element_widget(SCHEDULED_FORM_LIMIT_DATE));
	if ( !strcmp ( selected_item,
		       _("Custom")))
	{
	    gtk_widget_show (gsb_form_scheduler_get_element_widget(SCHEDULED_FORM_FREQUENCY_USER_ENTRY));
	    gtk_widget_show (gsb_form_scheduler_get_element_widget(SCHEDULED_FORM_FREQUENCY_USER_BUTTON));
	}
	else
	{
	    gtk_widget_hide (gsb_form_scheduler_get_element_widget(SCHEDULED_FORM_FREQUENCY_USER_ENTRY));
	    gtk_widget_hide (gsb_form_scheduler_get_element_widget(SCHEDULED_FORM_FREQUENCY_USER_BUTTON));
	}
    }
    g_free (selected_item);
    return FALSE;
}
示例#16
0
void
on_protocol_edit_ok_clicked (GtkButton * button, gpointer user_data)
{
  gchar *proto_string;
  GtkTreePath *gpath = NULL;
  GtkTreeViewColumn *gcol = NULL;
  GtkTreeIter it;
  GtkComboBoxEntry *cbox;
  EATreePos ep;
  if (!get_color_store (&ep))
    return;

  /* gets the row (path) at cursor */
  gtk_tree_view_get_cursor (ep.gv, &gpath, &gcol);
  if (!gpath)
    return;			/* no row selected */

  if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (ep.gs), &it, gpath))
    return;			/* path not found */

  cbox = GTK_COMBO_BOX_ENTRY(glade_xml_get_widget (appdata.xml, "protocol_entry"));
  proto_string = gtk_combo_box_get_active_text(GTK_COMBO_BOX(cbox));
  proto_string = g_utf8_strup (proto_string, -1);
  proto_string = remove_spaces(proto_string);
  
  cbox_add_select(cbox, proto_string);
  gtk_list_store_set (ep.gs, &it, 2, proto_string, -1);

  g_free (proto_string);
  gtk_widget_hide (glade_xml_get_widget (appdata.xml, "protocol_edit_dialog"));

  colors_changed = TRUE;
  color_list_to_pref ();
}				/* on_protocol_edit_ok_clicked */
示例#17
0
static int
airpcap_get_selected_channel_offset(GtkWidget *channel_offset_cb) {
    int offset;
    gchar *off_str;
    int retval = 0;
    

    if (channel_offset_cb == NULL || !GTK_WIDGET_SENSITIVE(channel_offset_cb)) {
        return 0;
    }
    
    off_str = gtk_combo_box_get_active_text(GTK_COMBO_BOX(channel_offset_cb));
    if (off_str && (g_ascii_strcasecmp("", off_str)))
    {
        if (airpcap_if_selected != NULL)
        {
            sscanf(off_str, "%d", &offset);
            if (offset >= -1 && offset <= 1) {
                retval = offset;
            }
        }
    }
    g_free(off_str);
    return retval;
}
示例#18
0
void
on_load_selection_clicked                (GtkButton       *button,
                                        gpointer         user_data)
{
  GtkComboBox* selection_type=GTK_COMBO_BOX(lookup_widget(GTK_WIDGET(button),"selection_type"));
  int active_id = gtk_combo_box_get_active(selection_type);
  GtkComboBox* list_selections=GTK_COMBO_BOX(lookup_widget(GTK_WIDGET(button),"list_selections"));
  char* active_text = gtk_combo_box_get_active_text(list_selections);
  if(active_id == CT_SIMPLE_SELECTION)
    {
      if(currentSelectionSet)
	{
	  //currentSelection->load(active_text);
	}
    }
  else
    {
      if(currentGraphCut)
	{
	  printf("Loading %s\n", currentGraphCut->graphcut_name.c_str());

	  if(cube->type == "uchar"){
	    currentGraphCut->load((Cube<uchar,ulong>*)cube, active_text);
	  }
	  else if(cube->type == "float"){
	    currentGraphCut->load((Cube<float,double>*)cube, active_text);
	  }
	  currentGraphCut->list();
	}
    }
}
示例#19
0
static void record_cylinder_changes(cylinder_t *cyl, struct cylinder_widget *cylinder)
{
	const gchar *desc;
	GtkComboBox *box;
	double volume, pressure, start, end;
	int o2, he;

	/* Ignore uninitialized cylinder widgets */
	box = cylinder->description;
	if (!box)
		return;

	desc = gtk_combo_box_get_active_text(box);
	volume = gtk_spin_button_get_value(cylinder->size);
	pressure = gtk_spin_button_get_value(cylinder->pressure);
	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->pressure_button))) {
		start = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->start));
		end = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->end));
	} else {
		start = end = 0;
	}
	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button))) {
		o2 = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->o2))*10 + 0.5;
		he = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->he))*10 + 0.5;
	} else {
		o2 = 0;
		he = 0;
	}
	fill_cylinder_info(cylinder, cyl, desc, volume, pressure, start, end, o2, he);
}
示例#20
0
void ISFSetupWin::update_factory_list_store (void)
{
    GtkTreeIter  iter;

    GdkPixbuf   *icon = NULL, *icon2 = NULL;
    GtkWidget   *pix = NULL, *pix2 = NULL;

    _display_selected_items = 0;
    pix   = gtk_image_new_from_file (ISE_SETUP_ICON_FILE);
    icon  = gtk_image_get_pixbuf (GTK_IMAGE (pix));
    pix2  = gtk_image_new_from_file (ISE_HELP_ICON_FILE);
    icon2 = gtk_image_get_pixbuf (GTK_IMAGE (pix2));

    String _app_name = gtk_combo_box_get_active_text ((GtkComboBox *) _combo_app);

    gtk_list_store_clear (_factory_list_store);
    std::vector<String>  f_show;
    for (MapStringVectorSizeT::iterator it = _groups.begin (); it != _groups.end (); ++it) {
        String lang_name;
        lang_name = scim_get_language_name (it->first);
        if (std::find (_disabled_langs.begin (), _disabled_langs.end (), lang_name) == _disabled_langs.end ()) {
            for (size_t i = 0; i < it->second.size (); i++) {
                // protect from add the same ise more than once in case of multiple langs.-->f_show list
                if (std::find (f_show.begin (), f_show.end (), _uuids[it->second[i]]) == f_show.end ()) {
                    gtk_list_store_append (_factory_list_store, &iter);
                    gtk_list_store_set (_factory_list_store, &iter,
                                        FACTORY_LIST_NAME,
                                        _names[it->second[i]].c_str (),
                                        FACTORY_LIST_MODULE_NAME,
                                        _module_names[it->second[i]].c_str (),
                                        FACTORY_LIST_UUID,
                                        _uuids[it->second[i]].c_str (),
                                        FACTORY_LIST_TYPE, (gint)_modes[it->second[i]],
                                        FACTORY_LIST_OPTION_PIX, icon,
                                        FACTORY_LIST_HELP_PIX,icon2,
                                        -1);
                    f_show.push_back (_uuids[it->second[i]]);


                    if (std::find (_disabled_ise_map[_app_name].begin (), _disabled_ise_map[_app_name].end (), _uuids[it->second[i]])
                        ==_disabled_ise_map[_app_name].end ()) {
                        gtk_list_store_set (_factory_list_store, &iter, FACTORY_LIST_ENABLE, true, -1);
                        _display_selected_items++;
                    } else {
                        gtk_list_store_set (_factory_list_store, &iter, FACTORY_LIST_ENABLE, false, -1);
                    }
                }
            }
        }
    }

    if (icon) {
        gdk_pixbuf_unref (icon);
        icon = 0;
    }
    if (icon2) {
        gdk_pixbuf_unref (icon2);
        icon2 = 0;
    }
}
示例#21
0
/**
 * gpk_prefs_update_freq_combo_changed:
 **/
static void
gpk_prefs_update_freq_combo_changed (GtkWidget *widget, gpointer data)
{
	gchar *value;
	guint freq = 0;
	GConfClient *client;

	client = gconf_client_get_default ();
	value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
	if (strcmp (value, PK_FREQ_HOURLY_TEXT) == 0)
		freq = GPK_PREFS_VALUE_HOURLY;
	else if (strcmp (value, PK_FREQ_DAILY_TEXT) == 0)
		freq = GPK_PREFS_VALUE_DAILY;
	else if (strcmp (value, PK_FREQ_WEEKLY_TEXT) == 0)
		freq = GPK_PREFS_VALUE_WEEKLY;
	else if (strcmp (value, PK_FREQ_NEVER_TEXT) == 0)
		freq = GPK_PREFS_VALUE_NEVER;
	else
		g_assert (FALSE);

	egg_debug ("Changing %s to %i", GPK_CONF_FREQUENCY_GET_UPDATES, freq);
	gconf_client_set_int (client, GPK_CONF_FREQUENCY_GET_UPDATES, freq, NULL);
	g_free (value);
	g_object_unref (client);
}
示例#22
0
文件: buses.c 项目: sargas/chitransit
void on_btnpacesched_clicked(GtkWidget *widget) {
	GtkComboBox *routeWidget = GTK_COMBO_BOX(glade_xml_get_widget(xml, "paceroutes"));
	gchar* route = gtk_combo_box_get_active_text(routeWidget);
	gchar url[512];
	g_snprintf(url,512,"%s/pacebus/%ssched.pdf",getProgData(NULL),route);
	openPDF(url);
}
示例#23
0
static void previewOutputMenuChange (GtkComboBox * combo, gpointer user_data)
{
    flyThreshold * myFly = static_cast <flyThreshold *> (user_data);
    uint32_t index = gtk_combo_box_get_active (combo);
    uint32_t filter_count;
    FILTER * filters = getCurrentVideoFilterList (&filter_count);
    FILTER * filter = filters + index;
    VF_FILTERS tag = filter->tag;

    gchar * activestr = gtk_combo_box_get_active_text (combo);

    printf ("user selected preview of #%d = %s (%d) @%p (was %p)\n",
            index, activestr, tag, filter->filter, myFly->getSource());

    if (strncmp (activestr, "XX ", 3) == 0)
    {
        printf ("selected preview source has different dimensions - "
                "forcing selection to current filter\n");
        gtk_combo_box_set_active (combo, myFly->this_filter_index);
    }
    else
    {
        flyThreshold::PreviewMode mode;
        if (index == myFly->this_filter_index)
            mode = flyThreshold::PREVIEWMODE_THIS_FILTER;
        else if (index > myFly->this_filter_index)
            mode = flyThreshold::PREVIEWMODE_LATER_FILTER;
        else // if (index < myFly->this_filter_index)
            mode = flyThreshold::PREVIEWMODE_EARLIER_FILTER;

        myFly->changeSource (filter->filter, mode);
    }

    g_free (activestr);
}
示例#24
0
static void display_command_activated(void)
{
  if ( display_command_sock >= 0 ) {
    char *cmd = (char *) gtk_combo_box_get_active_text(GTK_COMBO_BOX(display_command_combo));
    frame_ctl_command(display_command_sock, cmd);
  }
}
示例#25
0
static gchar*
geturl( FileAccessWindow* faw )
{
    gchar* url = NULL;
    const gchar* host;
    const gchar* database;
    const gchar* username;
    const gchar* password;
    const gchar* type;
    const gchar* file;
    const gchar* path;

    host = gtk_entry_get_text( faw->tf_host );
    database = gtk_entry_get_text( faw->tf_database );
    username = gtk_entry_get_text( faw->tf_username );
    password = gtk_entry_get_text( faw->tf_password );
    file = gtk_file_chooser_get_filename( faw->fileChooser );

    type = gtk_combo_box_get_active_text( faw->cb_uri_type );
    if ( gnc_uri_is_file_protocol( type ) )
    {
        if ( file == NULL ) /* file protocol was chosen but no filename was set */
            return NULL;
        else                /* file protocol was chosen with filename set */
            path = file;
    }
    else                    /* db protocol was chosen */
        path = database;

    url = gnc_uri_create_uri (type, host, 0, username, password, path);

    return url;
}
示例#26
0
/* "DiaZoomCombo" probably could work for both UI cases */
static void
integrated_ui_toolbar_zoom_combo_selection_changed (GtkComboBox *combo,
                                                    gpointer     user_data)
{
    /*
     * We call gtk_combo_get_get_active() so that typing in the combo entry
     * doesn't get handled as a selection change
     */
    if (gtk_combo_box_get_active (combo) != -1)
    {
        float zoom_percent;
        gchar * text;
#if GTK_CHECK_VERSION(2,24,0)
	text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT (combo));
#else
	text = gtk_combo_box_get_active_text (combo);
#endif
        if (sscanf (text, "%f", &zoom_percent) == 1)
        {
            view_zoom_set (zoom_percent * 10.0);
        }
        else if (g_ascii_strcasecmp (text, ZOOM_FIT) == 0)
        {
            view_show_all_callback (NULL);
        }

        g_free (text);
    }
}
示例#27
0
/* Make a list of available items of specified object , and Set the list to GtkComboBox */
short SetItemsToComboBox(GtkWidget* window, gchar *combo_name, short objectid , short currentid)
{
	GtkWidget* combo = LookupWidget(window, combo_name);

	LPCNCLDB lpdb = g_uidb.lpdbTop;
	char *str;
	short i,active_item,item_count;


	/* Remove all items in current list */
	if(gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ){
	
	
		while( 1 ){
			gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 );
			if( ! gtk_combo_box_get_active_text( GTK_COMBO_BOX( combo )) ) break;
			gtk_combo_box_remove_text( GTK_COMBO_BOX( combo ), 0 );
		}
	}


	/* Add available list (not disable items from UIDB ) */
	item_count = 0;
	active_item = 0;
	for( i = 0 ; i < g_uidb.dbsize ; i++, lpdb++ )
	{
		if( lpdb->nObjectID == objectid )
		{
			str = ValueToName(lpdb->nObjectID, lpdb->nValue);

			if( str != NULL )
			{
				if( *str != '\0' && lpdb->disable == 0 ){
					/* append one item */
					gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), str );
					if( lpdb->nValue == currentid ) active_item = item_count;
					item_count++;
				}
			}
		}
	}

	/* Set active item */
	gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), active_item );

	return item_count;
}
示例#28
0
static void
storage_changed (GtkComboBox *widget, dt_lib_export_t *d)
{
  gchar *name = gtk_combo_box_get_active_text(d->storage);
  darktable.gui->reset = 1;
  if(name) set_storage_by_name (d, name);
  darktable.gui->reset = 0;
}
示例#29
0
文件: compat.c 项目: pcwalton/NetSurf
gchar *nsgtk_combo_box_text_get_active_text(GtkWidget *combo_box)
{
  #if GTK_CHECK_VERSION(2,24,0)
	return gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box));
  #else
	return gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_box));
  #endif
}
示例#30
0
文件: table.c 项目: zizoumgs/Aman
gboolean tableChangeHari(GtkWidget* widget , gpointer p){
	tableRefresh("");	
	return TRUE;
	char *p_newChuckIcon;
	p_newChuckIcon = gtk_combo_box_get_active_text(widget);
	g_print("%s\n",p_newChuckIcon);
	g_free(p_newChuckIcon);
}