Example #1
0
static void
wired_private_init (CEPageWired *self)
{
	CEPageWiredPrivate *priv = CE_PAGE_WIRED_GET_PRIVATE (self);
	GtkBuilder *builder;
	GtkWidget *align;
	GtkLabel *label;

	builder = CE_PAGE (self)->builder;

#if GTK_CHECK_VERSION(2,24,0)
	priv->device_mac = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new_with_entry ());
	gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (priv->device_mac), 0);
#else
	priv->device_mac = GTK_COMBO_BOX_ENTRY (gtk_combo_box_entry_new_text ());
	gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (priv->device_mac), 0);
#endif
	gtk_widget_set_tooltip_text (GTK_WIDGET (priv->device_mac),
	                             _("This option locks this connection to the network device specified by its permanent MAC address entered here.  Example: 00:11:22:33:44:55"));

	align = GTK_WIDGET (gtk_builder_get_object (builder, "wired_device_mac_alignment"));
	gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (priv->device_mac));
	gtk_widget_show_all (GTK_WIDGET (priv->device_mac));

	/* Set mnemonic widget for device MAC label */
	label = GTK_LABEL (GTK_WIDGET (gtk_builder_get_object (builder, "wired_device_mac_label")));
	gtk_label_set_mnemonic_widget (label, GTK_WIDGET (priv->device_mac));

	priv->cloned_mac = GTK_ENTRY (GTK_WIDGET (gtk_builder_get_object (builder, "wired_cloned_mac")));
	priv->port = GTK_COMBO_BOX (GTK_WIDGET (gtk_builder_get_object (builder, "wired_port")));
	priv->speed = GTK_COMBO_BOX (GTK_WIDGET (gtk_builder_get_object (builder, "wired_speed")));
	priv->duplex = GTK_TOGGLE_BUTTON (GTK_WIDGET (gtk_builder_get_object (builder, "wired_duplex")));
	priv->autonegotiate = GTK_TOGGLE_BUTTON (GTK_WIDGET (gtk_builder_get_object (builder, "wired_autonegotiate")));
	priv->mtu = GTK_SPIN_BUTTON (GTK_WIDGET (gtk_builder_get_object (builder, "wired_mtu")));
}
Example #2
0
void
on_protocol_edit_dialog_show (GtkWidget * wdg, gpointer user_data)
{
  gchar *protocol_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 */

  gtk_tree_model_get (GTK_TREE_MODEL (ep.gs), &it, 2, &protocol_string, -1);

  cbox = GTK_COMBO_BOX_ENTRY(glade_xml_get_widget (appdata.xml, "protocol_entry"));
  cbox_add_select(cbox, protocol_string);

  g_free (protocol_string);
}
static void
vlan_private_init (CEPageVlan *self)
{
    CEPageVlanPrivate *priv = CE_PAGE_VLAN_GET_PRIVATE (self);
    GtkBuilder *builder;
    GtkWidget *align;
    GtkLabel *label;

    builder = CE_PAGE (self)->builder;

#if GTK_CHECK_VERSION(2,24,0)
    priv->parent = GTK_COMBO_BOX (gtk_combo_box_text_new_with_entry ());
    gtk_combo_box_set_entry_text_column (priv->parent, 0);
#else
    priv->parent = GTK_COMBO_BOX (gtk_combo_box_entry_new_text ());
    gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (priv->parent), 0);
#endif
    priv->parent_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->parent)));

    align = GTK_WIDGET (gtk_builder_get_object (builder, "vlan_parent_alignment"));
    gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (priv->parent));
    gtk_widget_show_all (GTK_WIDGET (priv->parent));

    /* Set mnemonic widget for parent label */
    label = GTK_LABEL (GTK_WIDGET (gtk_builder_get_object (builder, "vlan_parent_label")));
    gtk_label_set_mnemonic_widget (label, GTK_WIDGET (priv->parent));

    priv->id_entry = GTK_SPIN_BUTTON (GTK_WIDGET (gtk_builder_get_object (builder, "vlan_id_entry")));
    priv->name_entry = GTK_ENTRY (GTK_WIDGET (gtk_builder_get_object (builder, "vlan_name_entry")));
    priv->cloned_mac = GTK_ENTRY (GTK_WIDGET (gtk_builder_get_object (builder, "vlan_cloned_mac_entry")));
    priv->mtu = GTK_SPIN_BUTTON (GTK_WIDGET (gtk_builder_get_object (builder, "vlan_mtu")));
}
Example #4
0
void dbgromcall_create_window(GladeXML *xml)
{
	GtkTreeModel *model;
	GtkComboBox *combo;
	GtkEntry *entry;
	GtkEntryCompletion* completion;
	gpointer data;

	pbar = data = glade_xml_get_widget(xml, "progressbar1");
	combo = data = glade_xml_get_widget(xml, "comboboxentry1");
	entry = GTK_ENTRY(GTK_BIN(combo)->child);	

	// create storage
	store = gtk_list_store_new(CLIST_NCOLS,
				G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
				-1
            );
    model = GTK_TREE_MODEL(store);

	// and set storage
	gtk_combo_box_set_model(combo, model);
	gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(combo), COL_FULL);

	/* --- */

	// set auto-completion
	completion = gtk_entry_completion_new();
	gtk_entry_set_completion(entry, completion);
	gtk_entry_completion_set_model(completion, model);
	gtk_entry_completion_set_text_column (completion, COL_FULL);
	g_signal_connect(G_OBJECT(completion), "match-selected", 
		G_CALLBACK(on_combo_entry1_match_selected), NULL);
	//gtk_editable_select_region(GTK_EDITABLE(entry), 0, -1);
}
Example #5
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 */
Example #6
0
static void
confirm_changes(void)
{
  GtkWidget *widget = NULL;

  widget = glade_xml_get_widget (appdata.xml, "filter_combo");
  on_filter_entry_changed (GTK_COMBO_BOX_ENTRY(widget), NULL);

  widget = glade_xml_get_widget (appdata.xml, "center_combo");
  on_center_node_changed (GTK_COMBO_BOX_ENTRY(widget), NULL);

  if (colors_changed)
    {
      color_list_to_pref ();
      delete_gui_protocols ();
    }
}				/* confirm_changes */
Example #7
0
void
on_preferences1_activate (GtkMenuItem * menuitem, gpointer user_data)
{
  GtkComboBoxEntry *cbox;

  /* saves current prefs to a temporary */
  tmp_pref = duplicate_config(&pref);

  initialize_pref_controls();
  
  cbox = GTK_COMBO_BOX_ENTRY(glade_xml_get_widget (appdata.xml, "filter_combo"));
  cbox_add_select(cbox, pref.filter);

  cbox = GTK_COMBO_BOX_ENTRY(glade_xml_get_widget (appdata.xml, "center_combo"));
  cbox_add_select(cbox, pref.center_node);

  gtk_widget_show (diag_pref);
  gdk_window_raise (diag_pref->window);
}
Example #8
0
/*  Set the widget to display a certain currency name.
 *
 *  @param gce The currency editor widget to set.
 *
 *  @param currency The currency to set as the displayed/selected
 *  value of the widget.
 */
void
gnc_currency_edit_set_currency (GNCCurrencyEdit *gce,
                                const gnc_commodity *currency)
{
    const gchar *printname;

    g_return_if_fail(gce != NULL);
    g_return_if_fail(GNC_IS_CURRENCY_EDIT(gce));
    g_return_if_fail(currency != NULL);

    printname = gnc_commodity_get_printname(currency);
    gnc_cbe_set_by_string(GTK_COMBO_BOX_ENTRY(gce), printname);
}
Example #9
0
static GtkWidget *
create_comboboxentry(void)
{
  GtkWidget *comboboxentry, *entry;

  comboboxentry = gtk_combo_box_entry_new();
  gtk_combo_box_set_active(GTK_COMBO_BOX(comboboxentry), -1);
  gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(comboboxentry), 0);
  entry = gtk_bin_get_child(GTK_BIN(comboboxentry));
  gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE);
  gtk_widget_show(comboboxentry);
  return comboboxentry;
}
Example #10
0
int
clip_GTK_COMBOBOXENTRYGETTEXTCOLUMN(ClipMachine * ClipMachineMemory)
{
   C_widget *ccmb = _fetch_cw_arg(ClipMachineMemory);

   CHECKCWID(ccmb, GTK_IS_COMBO_BOX);

   _clip_retni(ClipMachineMemory, gtk_combo_box_entry_get_text_column(GTK_COMBO_BOX_ENTRY(ccmb->widget)) + 1);

   return 0;
 err:
   return 1;
}
Example #11
0
static void
presence_chooser_dialog_show (void)
{
	GladeXML *glade;
	gchar    *filename;

	if (message_dialog) {
		gtk_window_present (GTK_WINDOW (message_dialog->dialog));
		return;
	}

	message_dialog = g_new0 (CustomMessageDialog, 1);

	filename = empathy_file_lookup ("empathy-presence-chooser.glade",
					"libempathy-gtk");
	glade = empathy_glade_get_file (filename,
				       "custom_message_dialog",
				       NULL,
				       "custom_message_dialog", &message_dialog->dialog,
				       "checkbutton_save", &message_dialog->checkbutton_save,
				       "comboboxentry_message", &message_dialog->comboboxentry_message,
				       "combobox_status", &message_dialog->combobox_status,
				       NULL);
	g_free (filename);

	empathy_glade_connect (glade,
			       message_dialog,
			       "custom_message_dialog", "destroy", presence_chooser_dialog_destroy_cb,
			       "custom_message_dialog", "response", presence_chooser_dialog_response_cb,
			       "combobox_status", "changed", presence_chooser_dialog_status_changed_cb,
			       "checkbutton_save", "toggled", presence_chooser_dialog_save_toggled_cb,
			       NULL);

	g_object_unref (glade);

	/* Setup the message combobox */
	message_dialog->entry_message = GTK_BIN (message_dialog->comboboxentry_message)->child;
	gtk_entry_set_activates_default (GTK_ENTRY (message_dialog->entry_message), TRUE);
	gtk_entry_set_width_chars (GTK_ENTRY (message_dialog->entry_message), 25);
	g_signal_connect (message_dialog->entry_message, "changed",
			  G_CALLBACK (presence_chooser_dialog_message_changed_cb),
			  message_dialog);

	presence_chooser_dialog_setup (message_dialog);

	gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (message_dialog->comboboxentry_message), 0);

	/* FIXME: Set transian for a window ? */

	gtk_widget_show_all (message_dialog->dialog);
}
Example #12
0
static void
setup_shells_combo (GstUsersTool *tool)
{
	GtkWidget *combo;
	GtkTreeModel *model;

	combo = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "user_settings_shell");
	model = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_STRING));

	gtk_combo_box_set_model (GTK_COMBO_BOX (combo), model);
	g_object_unref (model);

	gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo), 0);
}
Example #13
0
int
clip_GTK_COMBOBOXENTRYSETTEXTCOLUMN(ClipMachine * ClipMachineMemory)
{
   C_widget *ccmb = _fetch_cw_arg(ClipMachineMemory);

   gint      text_column = _clip_parni(ClipMachineMemory, 2);

   CHECKCWID(ccmb, GTK_IS_COMBO_BOX);
   CHECKOPT(2, NUMERIC_type_of_ClipVarType);

   text_column--;
   gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(ccmb->widget), text_column);

   return 0;
 err:
   return 1;
}
static void
gn_combo_history_set_popdown_strings (GnComboHistory *history)
{
	GtkTreeModel *model;
	GtkTreeIter   iter;
	GSList *items;
	gchar  *text;
	gint    text_column, i;

	g_return_if_fail (GN_IS_COMBO_HISTORY (history));
	g_return_if_fail (GTK_IS_COMBO_BOX (history->priv->combo));

	model = gtk_combo_box_get_model (history->priv->combo);

	if (!model)
		return;

	text_column = gtk_combo_box_entry_get_text_column (
							   GTK_COMBO_BOX_ENTRY (history->priv->combo));

	gtk_list_store_clear (GTK_LIST_STORE (model));
	   
	if (! history->priv->items) {
             
		gtk_combo_box_set_active (GTK_COMBO_BOX (history->priv->combo), -1);
			 
		return;
	}

	i = 0;
	for (items = history->priv->items; items; items = items->next) {
		text = items->data;

		gtk_list_store_insert (GTK_LIST_STORE (model), &iter, i);
		gtk_list_store_set (GTK_LIST_STORE (model), &iter,
				    text_column, text,
				    -1);

		i ++;
	}

	/* At this point the current selection always be at the first place in the model */
	gtk_combo_box_set_active (GTK_COMBO_BOX (history->priv->combo), 0);
}
Example #15
0
/*!
  \brief fills in the AFR calibrator combobutton with the appropriate
  choices. The model stores the corresponding enum for later
  \param combo is a pointer to the combobutton to initialize
  \returns TRUE on success, FALSE otherwise
  */
G_MODULE_EXPORT gboolean populate_afr_calibrator_combo(GtkWidget *combo)
{
	GtkListStore *store = NULL;
	GtkTreeIter iter;
	gint i = 0;

	g_return_val_if_fail(GTK_IS_COMBO_BOX(combo),FALSE);

	store = gtk_list_store_new(NUM_COLS,G_TYPE_STRING,G_TYPE_INT);
	for (i=0;i<num_symbols;i++)
	{
		gtk_list_store_append(store,&iter);
		gtk_list_store_set(store,&iter,COL_NAME,AFR_Tables[i].name,COL_SYMBOL,AFR_Tables[i].symbol,-1);
	}
	gtk_combo_box_set_model(GTK_COMBO_BOX(combo),GTK_TREE_MODEL(store));
	gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(combo),0);

	return TRUE;
}
Example #16
0
void display_command_init(GtkWindow *window)
{
	/* Retrieve command entry widgets */
	display_command_box = lookup_widget(GTK_WIDGET(window), "command_box");
	gtk_widget_set_sensitive(display_command_box, 0);

	display_command_combo = GTK_COMBO_BOX_ENTRY(lookup_widget(GTK_WIDGET(window), "command_entry"));
	display_command_entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(display_command_combo)));
	gtk_signal_connect_object(GTK_OBJECT(display_command_entry), "activate",
				  GTK_SIGNAL_FUNC(display_command_activated), NULL);
	gtk_signal_connect_object(GTK_OBJECT(lookup_widget(GTK_WIDGET(window), "command_send")), "clicked",
				  GTK_SIGNAL_FUNC(display_command_activated), NULL);

	/* Create command history tree model */
	display_command_list = gtk_list_store_new(COMMAND_TREE_NCOLS,
						  /* COMMAND_TREE_ID   */ G_TYPE_INT,
						  /* COMMAND_TREE_TEXT */ G_TYPE_STRING);
	gtk_combo_box_set_model(GTK_COMBO_BOX(display_command_combo), GTK_TREE_MODEL(display_command_list));
	gtk_combo_box_entry_set_text_column(display_command_combo, COMMAND_TREE_TEXT);
}
Example #17
0
/**
   lw_create:
   create login window.
   Return value: The widget pointer of login window.
 */
GtkWidget*
lw_create(void)
{
	GtkBuilder *builder;
	GError* error = NULL;

	builder = gtk_builder_new ();
	if (!gtk_builder_add_from_file (builder, UI_FILE, &error))
	{
		g_error (_("Couldn't load builder file: %s"), error->message);
		g_error_free (error);
		_exit(1);
	}

	/* This is important */
	gtk_builder_connect_signals (builder, NULL);
	/* get gtk widget from builder */
	window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
	ety_pwd = GTK_WIDGET (gtk_builder_get_object (builder, "ety_pwd"));
	cbb_usr = GTK_WIDGET (gtk_builder_get_object (builder, "cbb_usr"));
	chb_svpwd=GTK_WIDGET (gtk_builder_get_object (builder, "chb_svpwd"));
	chb_apoffline=GTK_WIDGET (gtk_builder_get_object (builder,"chb_apoffline"));

	/* set up window */
	gtk_window_set_position (GTK_WINDOW(window), GTK_WIN_POS_CENTER_ALWAYS);

	/* set up password entry  */
	gtk_entry_set_visibility (GTK_ENTRY(ety_pwd), FALSE);

	/* set up user combo box */
	GtkListStore *usr_lst = gtk_list_store_new (1, G_TYPE_STRING);
	gtk_combo_box_set_model (GTK_COMBO_BOX (cbb_usr), GTK_TREE_MODEL (usr_lst));
	gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(cbb_usr), 0); 
	cfg_get_lists_usrlist (&get_usrlist_cb);
	
	g_object_unref (builder);

	//dbg_print("DBG: Login Window is created.");
	return window;
}
Example #18
0
/*  Create a new GNCCurrencyEdit widget which can be used to provide
 *  an easy way to enter ISO currency codes.
 *
 *  @return A GNCCurrencyEdit widget.
 */
GtkWidget *
gnc_currency_edit_new (void)
{
    GNCCurrencyEdit *gce;
    GtkListStore *store;

    store = gtk_list_store_new (1, G_TYPE_STRING);
    gce = g_object_new (GNC_TYPE_CURRENCY_EDIT,
                        "model", store,
                        "text-column", 0,
                        NULL);
    g_object_unref (store);

    /* Now the signals to make sure the user can't leave the
       widget without a valid currency. */
    gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(gce));

    /* Fill in all the data. */
    fill_currencies (gce);
    gtk_tree_sortable_set_sort_column_id
    (GTK_TREE_SORTABLE(store), 0, GTK_SORT_ASCENDING);

    return GTK_WIDGET (gce);
}
Example #19
0
GstConnectionDialog*
connection_dialog_init (GstTool *tool)
{
  GstConnectionDialog *gcd;

  gcd = g_new0 (GstConnectionDialog, 1);

  gcd->standalone = FALSE;
  gcd->iface  = NULL;
  gcd->dialog = gst_dialog_get_widget (tool->main_dialog, "connection_config_dialog");

  gcd->ok_button = gst_dialog_get_widget (tool->main_dialog, "connection_ok");

  gcd->notebook = gst_dialog_get_widget (tool->main_dialog, "connection_notebook");
  gcd->general_page = gst_dialog_get_widget (tool->main_dialog, "connection_general_page");
  gcd->modem_page = gst_dialog_get_widget (tool->main_dialog, "connection_modem_page");
  gcd->options_page = gst_dialog_get_widget (tool->main_dialog, "connection_options_page");

  gcd->connection_configured = gst_dialog_get_widget (tool->main_dialog, "connection_device_active");
  gcd->roaming_configured = gst_dialog_get_widget (tool->main_dialog, "connection_device_roaming");

  /* ethernet */
  gcd->bootproto_combo = gst_dialog_get_widget (tool->main_dialog, "connection_bootproto");
  gcd->address = gst_dialog_get_widget (tool->main_dialog, "connection_address");
  gcd->netmask = gst_dialog_get_widget (tool->main_dialog, "connection_netmask");
  gcd->gateway = gst_dialog_get_widget (tool->main_dialog, "connection_gateway");

  /* wireless */
  gcd->essid   = gst_dialog_get_widget (tool->main_dialog, "connection_essid");
  gcd->wep_key = gst_dialog_get_widget (tool->main_dialog, "connection_wep_key");
  gcd->key_type_combo = gst_dialog_get_widget (tool->main_dialog, "connection_wep_key_type");

  /* plip */
  gcd->local_address  = gst_dialog_get_widget (tool->main_dialog, "connection_local_address");
  gcd->remote_address = gst_dialog_get_widget (tool->main_dialog, "connection_remote_address");

  /* modem */
  gcd->ppp_type_combo = gst_dialog_get_widget (tool->main_dialog, "connection_ppp_type");
  gcd->ppp_type_box = gst_dialog_get_widget (tool->main_dialog, "connection_ppp_type_box");
  gcd->login        = gst_dialog_get_widget (tool->main_dialog, "connection_login");
  gcd->password     = gst_dialog_get_widget (tool->main_dialog, "connection_password");
  gcd->serial_port  = gst_dialog_get_widget (tool->main_dialog, "connection_serial_port");
  gcd->detect_modem = gst_dialog_get_widget (tool->main_dialog, "connection_detect_modem");
  gcd->phone_number = gst_dialog_get_widget (tool->main_dialog, "connection_phone_number");
  gcd->dial_prefix  = gst_dialog_get_widget (tool->main_dialog, "connection_dial_prefix");
  gcd->volume       = gst_dialog_get_widget (tool->main_dialog, "connection_volume");
  gcd->dial_type    = gst_dialog_get_widget (tool->main_dialog, "connection_dial_type");
  gcd->default_gw   = gst_dialog_get_widget (tool->main_dialog, "connection_default_gw");
  gcd->peerdns      = gst_dialog_get_widget (tool->main_dialog, "connection_peerdns");
  gcd->persist      = gst_dialog_get_widget (tool->main_dialog, "connection_persist");

  gcd->pppoe_interface_combo = gst_dialog_get_widget (tool->main_dialog, "connection_pppoe_ethernet");
  gcd->apn = gst_dialog_get_widget (tool->main_dialog, "connection_apn");

  gcd->pppoe_settings_table = gst_dialog_get_widget (tool->main_dialog, "connection_pppoe_settings_table");
  gcd->modem_settings_table = gst_dialog_get_widget (tool->main_dialog, "connection_modem_settings_table");
  gcd->modem_isp_table = gst_dialog_get_widget (tool->main_dialog, "connection_modem_isp_table");
  gcd->gprs_isp_table = gst_dialog_get_widget (tool->main_dialog, "connection_gprs_isp_table");

  gcd->wireless_frame = gst_dialog_get_widget (tool->main_dialog, "connection_wireless");
  gcd->ethernet_frame = gst_dialog_get_widget (tool->main_dialog, "connection_ethernet");
  gcd->plip_frame     = gst_dialog_get_widget (tool->main_dialog, "connection_plip");
  gcd->isp_frame      = gst_dialog_get_widget (tool->main_dialog, "isp_data");
  gcd->account_frame  = gst_dialog_get_widget (tool->main_dialog, "isp_account_data");

  gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (gcd->serial_port), 0);

  connection_essids_combo_init (GTK_COMBO_BOX_ENTRY (gcd->essid));
  connection_pppoe_combo_init (GTK_COMBO_BOX (gcd->pppoe_interface_combo));

  return gcd;
}
Example #20
0
/*
** get widgets contents to the selected account
*/
static void defarchive_getlast(struct defarchive_data *data)
{
gchar *txt;
gboolean bool;
gdouble value;
gint active;
Archive *item;

	DB( g_print("(defarchive) getlast\n") );

	item = data->lastarcitem;
	
	if( item != NULL )
	{
		DB( g_print(" -> %s\n", item->wording) );

		txt = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_word));
		// ignore if entry is empty
		if (txt && *txt)
		{
			g_free(item->wording);
			item->wording = g_strdup(txt);
		}

		gtk_tree_view_columns_autosize (GTK_TREE_VIEW(data->LV_arc));

		value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->ST_amount));
		item->amount = value;

		item->flags = 0;

		active = item->amount > 0 ? TRUE : FALSE;
		//active = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_amount));
		if(active == 1) item->flags |= OF_INCOME;

		bool = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_cheque));
		if(bool) item->flags |= OF_CHEQ2;

		bool = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_valid));
		if(bool) item->flags |= OF_VALID;

		bool = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_remind));
		if(bool == 1) item->flags |= OF_REMIND;

		item->paymode		= gtk_combo_box_get_active(GTK_COMBO_BOX(data->NU_mode));
		item->category		= ui_cat_comboboxentry_get_key_add_new(GTK_COMBO_BOX_ENTRY(data->PO_grp));
		item->payee			= ui_pay_comboboxentry_get_key_add_new(GTK_COMBO_BOX_ENTRY(data->PO_pay));
		item->account		= ui_acc_comboboxentry_get_key(GTK_COMBO_BOX_ENTRY(data->PO_acc));
		item->dst_account	= ui_acc_comboboxentry_get_key(GTK_COMBO_BOX_ENTRY(data->PO_accto));

		DB( g_print(" -> PO_acc %d\n", item->account) );
		DB( g_print(" -> PO_accto %d\n", item->dst_account) );

		bool = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_auto));
		if(bool) item->flags |= OF_AUTO;

		item->every   = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_every));
		item->unit    = gtk_combo_box_get_active(GTK_COMBO_BOX(data->CY_unit));
		item->nextdate	= gtk_dateentry_get_date(GTK_DATE_ENTRY(data->PO_next));

		bool = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_limit));
		if(bool) item->flags |= OF_LIMIT;

		item->limit   = gtk_spin_button_get_value(GTK_SPIN_BUTTON(data->NB_limit));

		data->change++;
	}
Example #21
0
static void
gimp_scale_combo_box_init (GimpScaleComboBox *combo_box)
{
  GtkWidget       *entry;
  GtkListStore    *store;
  GtkCellLayout   *layout;
  GtkCellRenderer *cell;
  GtkTreeIter      iter;
  GtkBorder        border = { 0, 0, 0, 0 };
  gint             i;

  combo_box->scale     = 1.0;
  combo_box->last_path = NULL;

  store = gtk_list_store_new (NUM_COLUMNS,
                              G_TYPE_DOUBLE,    /* SCALE       */
                              G_TYPE_STRING,    /* LABEL       */
                              G_TYPE_BOOLEAN);  /* PERSISTENT  */

  gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
  g_object_unref (store);

  gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo_box), LABEL);

  entry = gtk_bin_get_child (GTK_BIN (combo_box));

  g_object_set (entry,
                "xalign",             1.0,
                "width-chars",        7,
                "truncate-multiline", TRUE,
                "inner-border",       &border,
                NULL);

  layout = GTK_CELL_LAYOUT (combo_box);

  cell = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT,
                       "xalign", 1.0,
                       NULL);

  gtk_cell_layout_clear (layout);
  gtk_cell_layout_pack_start (layout, cell, TRUE);
  gtk_cell_layout_set_attributes (layout, cell,
                                  "text", LABEL,
                                  NULL);

  for (i = 8; i > 0; i /= 2)
    {
      gtk_list_store_append (store, &iter);
      gimp_scale_combo_box_scale_iter_set (store, &iter, i, TRUE);
    }

  for (i = 2; i <= 8; i *= 2)
    {
      gtk_list_store_append (store, &iter);
      gimp_scale_combo_box_scale_iter_set (store, &iter, 1.0 / i, TRUE);
    }

  g_signal_connect (combo_box, "changed",
                    G_CALLBACK (gimp_scale_combo_box_changed),
                    NULL);

  g_signal_connect (entry, "activate",
                    G_CALLBACK (gimp_scale_combo_box_entry_activate),
                    combo_box);
  g_signal_connect (entry, "key-press-event",
                    G_CALLBACK (gimp_scale_combo_box_entry_key_press),
                    combo_box);
}
Example #22
0
static void
empathy_presence_chooser_init (EmpathyPresenceChooser *chooser)
{
	EmpathyPresenceChooserPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (chooser,
		EMPATHY_TYPE_PRESENCE_CHOOSER, EmpathyPresenceChooserPriv);
	GtkWidget *entry;
	GtkCellRenderer *renderer;

	chooser->priv = priv;

	presence_chooser_create_model (chooser);

	gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (chooser),
					     COL_STATUS_TEXT);
	gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (chooser),
					      combo_row_separator_func,
					      NULL, NULL);

	entry = gtk_bin_get_child (GTK_BIN (chooser));
	gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
					GTK_ENTRY_ICON_PRIMARY,
					FALSE);

	g_signal_connect_swapped (entry, "icon-release",
		G_CALLBACK (presence_chooser_entry_icon_release_cb),
		chooser);
	g_signal_connect_swapped (entry, "activate",
		G_CALLBACK (presence_chooser_entry_activate_cb),
		chooser);
	g_signal_connect_swapped (entry, "key-press-event",
		G_CALLBACK (presence_chooser_entry_key_press_event_cb),
		chooser);
	g_signal_connect_swapped (entry, "button-press-event",
		G_CALLBACK (presence_chooser_entry_button_press_event_cb),
		chooser);

	gtk_cell_layout_clear (GTK_CELL_LAYOUT (chooser));

	renderer = gtk_cell_renderer_pixbuf_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (chooser), renderer, FALSE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (chooser), renderer,
					"icon-name", COL_STATE_ICON_NAME,
					NULL);
	g_object_set (renderer, "stock-size", GTK_ICON_SIZE_MENU, NULL);

	renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (chooser), renderer, TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (chooser), renderer,
					"markup", COL_DISPLAY_MARKUP,
					NULL);

	g_signal_connect (chooser, "notify::popup-shown",
			G_CALLBACK (presence_chooser_popup_shown_cb), NULL);
	g_signal_connect (chooser, "changed",
			G_CALLBACK (presence_chooser_changed_cb), NULL);
	g_signal_connect_swapped (entry, "changed",
			G_CALLBACK (presence_chooser_entry_changed_cb),
			chooser);
	g_signal_connect_swapped (entry, "focus-out-event",
			G_CALLBACK (presence_chooser_entry_focus_out_cb),
			chooser);

	priv->idle = empathy_idle_dup_singleton ();
	presence_chooser_presence_changed_cb (chooser);
	g_signal_connect_swapped (priv->idle, "notify",
		G_CALLBACK (presence_chooser_presence_changed_cb),
		chooser);

	/* FIXME: this string sucks */
	gtk_widget_set_tooltip_text (GTK_WIDGET (chooser),
		_("Set your presence and current status"));
}
Example #23
0
/*!
  \brief sets up and populates the MS2-Extra combo for output choice
  \param widget is the pointer to the combo to initialize
  */
G_MODULE_EXPORT void ms2_output_combo_setup(GtkWidget *widget)
{
	guint i = 0;
	GtkWidget *parent = NULL;
	gchar * lower = NULL;
	gchar * upper = NULL;
	gfloat * multiplier = NULL;
	gfloat * adder = NULL;
	gfloat * testmult = NULL;
	gchar * range = NULL;
	gint bitval = 0;
	gint width = 0;
	DataSize size = MTX_U08;
	gint precision = 0;
	gconstpointer * object = NULL;
	gint raw_lower = 0;
	gint raw_upper = 0;
	gboolean freelower = FALSE;
	gboolean freeupper = FALSE;
	gchar *raw_lower_str = NULL;
	gchar *raw_upper_str = NULL;
	gfloat real_lower = 0.0;
	gfloat real_upper = 0.0;
	gfloat tmpf = 0.0;
	gchar * name = NULL;
	gchar *internal_names = NULL;
	GtkWidget *entry = NULL;
	GtkEntryCompletion *completion = NULL;
	GtkListStore *store = NULL;
	GtkTreeIter iter;

	ENTER();
	Rtv_Map *rtv_map = NULL;

	rtv_map = (Rtv_Map *)DATA_GET(global_data,"rtv_map");

	if (!rtv_map)
	{
		EXIT();
		return;
	}
	/* Create the store for the combo, with severla hidden values
	 */
	store = gtk_list_store_new(UO_COMBO_COLS,G_TYPE_STRING,G_TYPE_UCHAR,G_TYPE_POINTER,G_TYPE_POINTER,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UCHAR,G_TYPE_UCHAR);

	/* Iterate across valid variables */
	for (i=0;i<rtv_map->rtv_list->len;i++)
	{
		freelower = FALSE;
		freeupper = FALSE;
		object = NULL;
		name = NULL;
		object = (gconstpointer *)g_ptr_array_index(rtv_map->rtv_list,i);
		if (!object)
			continue;
		name = (gchar *) DATA_GET(object,"dlog_gui_name");
		if (!name)
			continue;
		if (DATA_GET(object,"fromecu_complex"))
			continue;
		if (DATA_GET(object,"special"))
			continue;
		internal_names = (gchar *) DATA_GET(object,"internal_names");
		if (!find_in_list(rtv_map->raw_list,internal_names))
			continue;

		size = (DataSize)(GINT)DATA_GET(object,"size");
		multiplier = (gfloat *)DATA_GET(object,"fromecu_mult");
		adder = (gfloat *)DATA_GET(object,"fromecu_add");
		precision = (GINT) DATA_GET(object,"precision");
		bitval = (GINT) DATA_GET(object,"offset");
		if (DATA_GET(object,"real_lower"))
		{
			lower = (gchar *)DATA_GET(object,"real_lower");
			real_lower = g_strtod(lower,NULL);
			raw_lower = calc_value_f(real_lower,multiplier,adder,TOECU);
		}
		else
		{
			raw_lower = get_extreme_from_size_f(size,LOWER);
			tmpf = calc_value_f(raw_lower,multiplier,adder,FROMECU);
			lower = g_strdup_printf("%i",(gint)tmpf);
			freelower = TRUE;
		}
		if (DATA_GET(object,"real_upper"))
		{
			upper = (gchar *)DATA_GET(object,"real_upper");
			real_upper = g_strtod(upper,NULL);
			raw_upper = calc_value_f(real_upper,multiplier,adder,TOECU);
		}
		else
		{
			raw_upper = get_extreme_from_size_f(size,UPPER);
			tmpf = calc_value_f(raw_upper,multiplier,adder,FROMECU);
			upper = g_strdup_printf("%i",(gint)tmpf);
			freeupper = TRUE;
		}
		range = g_strdup_printf("Valid Range: %s <-> %s",lower,upper);
		if (freelower)
			g_free(lower);
		if (freeupper)
			g_free(upper);
		if ((multiplier) && (adder))
		{
			raw_lower = (GINT)((real_lower - (*adder))/(*multiplier));
			raw_upper = (GINT)((real_upper - (*adder))/(*multiplier));
		}
		else if (multiplier)
		{
			raw_lower = (GINT)(real_lower/(*multiplier));
			raw_upper = (GINT)(real_upper/(*multiplier));
		}
		else
		{
			raw_lower = (GINT)real_lower;
			raw_upper = (GINT)real_upper;
		}
		raw_lower_str = g_strdup_printf("%i",raw_lower);
		raw_upper_str = g_strdup_printf("%i",raw_upper);

		gtk_list_store_append(store,&iter);
		gtk_list_store_set(store,&iter,
				UO_CHOICE_COL,name,
				UO_BITVAL_COL,bitval,
				UO_FROMECU_MULT_COL,multiplier,
				UO_FROMECU_ADD_COL,adder,
				UO_RAW_LOWER_COL,raw_lower_str,
				UO_RAW_UPPER_COL,raw_upper_str,
				UO_RANGE_COL,range,
				UO_SIZE_COL,size,
				UO_PRECISION_COL,precision,
				-1);
		g_free(raw_lower_str);
		g_free(raw_upper_str);
		g_free(range);
	}
/*#if GTK_MINOR_VERSION < 24 */
	if (GTK_IS_COMBO_BOX_ENTRY(widget))
	{
		gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(widget),UO_CHOICE_COL);
/*
#else
	if (GTK_IS_COMBO_BOX(widget))
	{
		gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(widget),UO_CHOICE_COL);
#endif
*/
		gtk_combo_box_set_model(GTK_COMBO_BOX(widget),GTK_TREE_MODEL(store));
		g_object_unref(store);
		entry = gtk_bin_get_child(GTK_BIN(widget));
		/* Nasty hack, but otherwise the entry is an obnoxious size.. */
		if ((width = (GINT)OBJ_GET((GtkWidget *)widget,"max_chars")) > 0)
			gtk_entry_set_width_chars(GTK_ENTRY(entry),width);
		else
			gtk_entry_set_width_chars(GTK_ENTRY(entry),12);

		gtk_widget_set_size_request(GTK_WIDGET(widget),-1,(3*(GINT)DATA_GET(global_data,"font_size")));

//		gtk_container_remove (GTK_CONTAINER (widget), gtk_bin_get_child(GTK_BIN(widget)));
//		gtk_container_add (GTK_CONTAINER (widget), entry);

		completion = gtk_entry_completion_new();
		gtk_entry_set_completion(GTK_ENTRY(entry),completion);
		g_object_unref(completion);
		gtk_entry_completion_set_model(completion,GTK_TREE_MODEL(store));
		gtk_entry_completion_set_text_column(completion,UO_CHOICE_COL);
		gtk_entry_completion_set_inline_completion(completion,TRUE);
		gtk_entry_completion_set_inline_selection(completion,TRUE);
		gtk_entry_completion_set_popup_single_match(completion,FALSE);
		OBJ_SET(widget,"arrow-size",GINT_TO_POINTER(1));
	}
	EXIT();
	return;
}
Example #24
0
void gui_init(dt_lib_module_t *self)
{
  GtkBox *hbox;
  GtkWidget *button;
  GtkWidget *label;
  GtkEntryCompletion *completion;

  dt_lib_metadata_t *d = (dt_lib_metadata_t *)malloc(sizeof(dt_lib_metadata_t));
  self->data = (void *)d;

  d->imgsel = -1;

  self->widget = gtk_table_new(6, 2, FALSE);
  gtk_table_set_row_spacings(GTK_TABLE(self->widget), 5);

  g_signal_connect(self->widget, "expose-event", G_CALLBACK(expose), self);
 
  label = gtk_label_new(_("title"));
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
  gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
  d->title = GTK_COMBO_BOX_ENTRY(gtk_combo_box_entry_new_text());
  dt_gui_key_accel_block_on_focus(GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->title))));
  completion = gtk_entry_completion_new();
  gtk_entry_completion_set_model(completion, gtk_combo_box_get_model(GTK_COMBO_BOX(d->title)));
  gtk_entry_completion_set_text_column(completion, 0);
  gtk_entry_completion_set_inline_completion(completion, TRUE);
  gtk_entry_set_completion(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->title))), completion);
  g_signal_connect (GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->title))), "activate", G_CALLBACK (enter_pressed), self);
  gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->title), 1, 2, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);

  label = gtk_label_new(_("description"));
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
  gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
  d->description = GTK_COMBO_BOX_ENTRY(gtk_combo_box_entry_new_text());
  dt_gui_key_accel_block_on_focus(GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->description))));
  completion = gtk_entry_completion_new();
  gtk_entry_completion_set_model(completion, gtk_combo_box_get_model(GTK_COMBO_BOX(d->description)));
  gtk_entry_completion_set_text_column(completion, 0);
  gtk_entry_completion_set_inline_completion(completion, TRUE);
  gtk_entry_set_completion(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->description))), completion);
  g_signal_connect (GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->description))), "activate", G_CALLBACK (enter_pressed), self);
  gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->description), 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);

  label = gtk_label_new(_("creator"));
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
  gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
  d->creator = GTK_COMBO_BOX_ENTRY(gtk_combo_box_entry_new_text());
  dt_gui_key_accel_block_on_focus(GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->creator))));
  completion = gtk_entry_completion_new();
  gtk_entry_completion_set_model(completion, gtk_combo_box_get_model(GTK_COMBO_BOX(d->creator)));
  gtk_entry_completion_set_text_column(completion, 0);
  gtk_entry_completion_set_inline_completion(completion, TRUE);
  gtk_entry_set_completion(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->creator))), completion);
  g_signal_connect (GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->creator))), "activate", G_CALLBACK (enter_pressed), self);
  gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->creator), 1, 2, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);

  label = gtk_label_new(_("publisher"));
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
  gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 3, 4, GTK_EXPAND|GTK_FILL, 0, 0, 0);
  d->publisher = GTK_COMBO_BOX_ENTRY(gtk_combo_box_entry_new_text());
  dt_gui_key_accel_block_on_focus(GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->publisher))));
  completion = gtk_entry_completion_new();
  gtk_entry_completion_set_model(completion, gtk_combo_box_get_model(GTK_COMBO_BOX(d->publisher)));
  gtk_entry_completion_set_text_column(completion, 0);
  gtk_entry_completion_set_inline_completion(completion, TRUE);
  gtk_entry_set_completion(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->publisher))), completion);
  g_signal_connect (GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->publisher))), "activate", G_CALLBACK (enter_pressed), self);
  gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->publisher), 1, 2, 3, 4, GTK_EXPAND|GTK_FILL, 0, 0, 0);

  label = gtk_label_new(_("rights"));
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
  gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 4, 5, GTK_EXPAND|GTK_FILL, 0, 0, 0);
  d->rights = GTK_COMBO_BOX_ENTRY(gtk_combo_box_entry_new_text());
  dt_gui_key_accel_block_on_focus(GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->rights))));
  completion = gtk_entry_completion_new();
  gtk_entry_completion_set_model(completion, gtk_combo_box_get_model(GTK_COMBO_BOX(d->rights)));
  gtk_entry_completion_set_text_column(completion, 0);
  gtk_entry_completion_set_inline_completion(completion, TRUE);
  gtk_entry_set_completion(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->rights))), completion);
  g_signal_connect (GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->rights))), "activate", G_CALLBACK (enter_pressed), self);
  gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->rights), 1, 2, 4, 5, GTK_EXPAND|GTK_FILL, 0, 0, 0);

  g_object_unref(completion);

  // reset/apply buttons
  hbox = GTK_BOX(gtk_hbox_new(TRUE, 5));

  button = gtk_button_new_with_label(_("clear"));
  d->clear_button = button;
  g_object_set(G_OBJECT(button), "tooltip-text", _("remove metadata from selected images"), (char *)NULL);
  gtk_box_pack_start(hbox, button, FALSE, TRUE, 0);
  g_signal_connect(G_OBJECT (button), "clicked",
                   G_CALLBACK (clear_button_clicked), (gpointer)self);

  button = gtk_button_new_with_label(_("apply"));
  d->apply_button = button;
  g_object_set(G_OBJECT(button), "tooltip-text", _("write metadata for selected images"), (char *)NULL);
  g_signal_connect(G_OBJECT (button), "clicked",
                   G_CALLBACK (apply_button_clicked), (gpointer)self);
  gtk_box_pack_start(hbox, button, FALSE, TRUE, 0);

  gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(hbox), 0, 2, 5, 6, GTK_EXPAND|GTK_FILL, 0, 0, 0);

  /* lets signup for mouse over image change signals */
  dt_control_signal_connect(darktable.signals,DT_SIGNAL_MOUSE_OVER_IMAGE_CHANGE, 
			    G_CALLBACK(_mouse_over_image_callback), self);

}
Example #25
0
RygelGeneralPrefSection* rygel_general_pref_section_construct (GType object_type, GtkBuilder* builder, RygelUserConfig* config, GError** error) {
#line 157 "rygel-general-pref-section.c"
	GError * _inner_error_;
	RygelGeneralPrefSection * self;
	GtkCheckButton* _tmp0_;
	GtkComboBoxEntry* _tmp1_;
	GtkSpinButton* _tmp2_;
	GtkCheckButton* _tmp3_;
	GtkCheckButton* _tmp4_;
	GtkCheckButton* _tmp5_;
	GtkCheckButton* _tmp6_;
	GUPnPContextManager* _tmp7_;
#line 47 "rygel-general-pref-section.vala"
	g_return_val_if_fail (builder != NULL, NULL);
#line 47 "rygel-general-pref-section.vala"
	g_return_val_if_fail (config != NULL, NULL);
#line 172 "rygel-general-pref-section.c"
	_inner_error_ = NULL;
#line 49 "rygel-general-pref-section.vala"
	self = (RygelGeneralPrefSection*) rygel_preferences_section_construct (object_type, config, "general");
#line 51 "rygel-general-pref-section.vala"
	self->priv->upnp_check = (_tmp0_ = _g_object_ref0 (GTK_CHECK_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_UPNP_CHECKBUTTON))), _g_object_unref0 (self->priv->upnp_check), _tmp0_);
#line 52 "rygel-general-pref-section.vala"
	g_assert (self->priv->upnp_check != NULL);
#line 53 "rygel-general-pref-section.vala"
	self->priv->iface_entry = (_tmp1_ = _g_object_ref0 (GTK_COMBO_BOX_ENTRY (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_IFACE_ENTRY))), _g_object_unref0 (self->priv->iface_entry), _tmp1_);
#line 54 "rygel-general-pref-section.vala"
	g_assert (self->priv->iface_entry != NULL);
#line 55 "rygel-general-pref-section.vala"
	self->priv->port_spin = (_tmp2_ = _g_object_ref0 (GTK_SPIN_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_PORT_SPINBUTTON))), _g_object_unref0 (self->priv->port_spin), _tmp2_);
#line 56 "rygel-general-pref-section.vala"
	g_assert (self->priv->port_spin != NULL);
#line 57 "rygel-general-pref-section.vala"
	self->priv->trans_check = (_tmp3_ = _g_object_ref0 (GTK_CHECK_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_TRANS_CHECKBUTTON))), _g_object_unref0 (self->priv->trans_check), _tmp3_);
#line 58 "rygel-general-pref-section.vala"
	g_assert (self->priv->trans_check != NULL);
#line 59 "rygel-general-pref-section.vala"
	self->priv->mp3_check = (_tmp4_ = _g_object_ref0 (GTK_CHECK_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_MP3_CHECKBUTTON))), _g_object_unref0 (self->priv->mp3_check), _tmp4_);
#line 60 "rygel-general-pref-section.vala"
	g_assert (self->priv->mp3_check != NULL);
#line 61 "rygel-general-pref-section.vala"
	self->priv->mp2ts_check = (_tmp5_ = _g_object_ref0 (GTK_CHECK_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_MP2TS_CHECKBUTTON))), _g_object_unref0 (self->priv->mp2ts_check), _tmp5_);
#line 62 "rygel-general-pref-section.vala"
	g_assert (self->priv->mp2ts_check != NULL);
#line 63 "rygel-general-pref-section.vala"
	self->priv->lpcm_check = (_tmp6_ = _g_object_ref0 (GTK_CHECK_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_LPCM_CHECKBUTTON))), _g_object_unref0 (self->priv->lpcm_check), _tmp6_);
#line 64 "rygel-general-pref-section.vala"
	g_assert (self->priv->lpcm_check != NULL);
#line 66 "rygel-general-pref-section.vala"
	self->priv->context_manager = (_tmp7_ = gupnp_context_manager_new (NULL, (guint) 0), _g_object_unref0 (self->priv->context_manager), _tmp7_);
#line 69 "rygel-general-pref-section.vala"
	gtk_combo_box_entry_set_text_column (self->priv->iface_entry, 0);
#line 208 "rygel-general-pref-section.c"
	{
		char* _tmp8_;
		char* _tmp9_;
#line 71 "rygel-general-pref-section.vala"
		_tmp8_ = rygel_configuration_get_interface ((RygelConfiguration*) config, &_inner_error_);
#line 214 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch1_g_error;
		}
#line 71 "rygel-general-pref-section.vala"
		gtk_combo_box_append_text ((GtkComboBox*) self->priv->iface_entry, _tmp9_ = _tmp8_);
#line 220 "rygel-general-pref-section.c"
		_g_free0 (_tmp9_);
#line 72 "rygel-general-pref-section.vala"
		gtk_combo_box_set_active ((GtkComboBox*) self->priv->iface_entry, 0);
#line 224 "rygel-general-pref-section.c"
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally1:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gint _tmp10_;
#line 78 "rygel-general-pref-section.vala"
		_tmp10_ = rygel_configuration_get_port ((RygelConfiguration*) config, &_inner_error_);
#line 246 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch2_g_error;
		}
#line 78 "rygel-general-pref-section.vala"
		gtk_spin_button_set_value (self->priv->port_spin, (double) _tmp10_);
#line 252 "rygel-general-pref-section.c"
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally2:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gboolean _tmp11_;
#line 81 "rygel-general-pref-section.vala"
		_tmp11_ = rygel_configuration_get_upnp_enabled ((RygelConfiguration*) ((RygelPreferencesSection*) self)->config, &_inner_error_);
#line 274 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch3_g_error;
		}
#line 81 "rygel-general-pref-section.vala"
		gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->upnp_check, _tmp11_);
#line 280 "rygel-general-pref-section.c"
	}
	goto __finally3;
	__catch3_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally3:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gboolean _tmp12_;
#line 84 "rygel-general-pref-section.vala"
		_tmp12_ = rygel_configuration_get_transcoding ((RygelConfiguration*) ((RygelPreferencesSection*) self)->config, &_inner_error_);
#line 302 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch4_g_error;
		}
#line 84 "rygel-general-pref-section.vala"
		gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->trans_check, _tmp12_);
#line 308 "rygel-general-pref-section.c"
	}
	goto __finally4;
	__catch4_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally4:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gboolean _tmp13_;
#line 87 "rygel-general-pref-section.vala"
		_tmp13_ = rygel_configuration_get_mp3_transcoder ((RygelConfiguration*) ((RygelPreferencesSection*) self)->config, &_inner_error_);
#line 330 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch5_g_error;
		}
#line 87 "rygel-general-pref-section.vala"
		gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->mp3_check, _tmp13_);
#line 336 "rygel-general-pref-section.c"
	}
	goto __finally5;
	__catch5_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally5:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gboolean _tmp14_;
#line 90 "rygel-general-pref-section.vala"
		_tmp14_ = rygel_configuration_get_mp2ts_transcoder ((RygelConfiguration*) ((RygelPreferencesSection*) self)->config, &_inner_error_);
#line 358 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch6_g_error;
		}
#line 90 "rygel-general-pref-section.vala"
		gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->mp2ts_check, _tmp14_);
#line 364 "rygel-general-pref-section.c"
	}
	goto __finally6;
	__catch6_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally6:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gboolean _tmp15_;
#line 93 "rygel-general-pref-section.vala"
		_tmp15_ = rygel_configuration_get_lpcm_transcoder ((RygelConfiguration*) ((RygelPreferencesSection*) self)->config, &_inner_error_);
#line 386 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch7_g_error;
		}
#line 93 "rygel-general-pref-section.vala"
		gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->lpcm_check, _tmp15_);
#line 392 "rygel-general-pref-section.c"
	}
	goto __finally7;
	__catch7_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally7:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
#line 96 "rygel-general-pref-section.vala"
	g_signal_connect_object ((GtkToggleButton*) self->priv->trans_check, "toggled", (GCallback) _rygel_general_pref_section_on_trans_check_toggled_gtk_toggle_button_toggled, self, 0);
#line 98 "rygel-general-pref-section.vala"
	g_signal_connect_object (self->priv->context_manager, "context-available", (GCallback) _rygel_general_pref_section_on_context_available_gupnp_context_manager_context_available, self, 0);
#line 100 "rygel-general-pref-section.vala"
	g_signal_connect_object (self->priv->context_manager, "context-unavailable", (GCallback) _rygel_general_pref_section_on_context_unavailable_gupnp_context_manager_context_unavailable, self, 0);
#line 104 "rygel-general-pref-section.vala"
	rygel_general_pref_section_on_trans_check_toggled (self, self->priv->trans_check);
#line 418 "rygel-general-pref-section.c"
	return self;
}
Example #26
0
/*!
  \brief sets up and populates the MS2-Extra combo for output choice
  \param widget is the pointer to the combo to initialize
  */
G_MODULE_EXPORT void ms2_output_combo_setup(GtkWidget *widget)
{
	guint i = 0;
	GtkWidget *parent = NULL;
	gchar * lower = NULL;
	gchar * upper = NULL;
	gfloat * multiplier = NULL;
	gfloat * adder = NULL;
	gfloat * testmult = NULL;
	gchar * range = NULL;
	gint bitval = 0;
	gint width = 0;
	DataSize size = MTX_U08;
	gint precision = 0;
	gconstpointer * object = NULL;
	gint raw_lower = 0;
	gint raw_upper = 0;
	gboolean temp_dep = FALSE;
	gchar *raw_lower_str = NULL;
	gchar *raw_upper_str = NULL;
	gchar *tempc_range = NULL;
	gchar *tempf_range = NULL;
	gchar *tempk_range = NULL;
	gfloat real_lower = 0.0;
	gfloat real_upper = 0.0;
	gfloat tmpf = 0.0;
	gchar * name = NULL;
	gchar *internal_names = NULL;
	GtkWidget *entry = NULL;
	GtkEntryCompletion *completion = NULL;
	GtkListStore *store = NULL;
	GtkTreeIter iter;

	ENTER();
	Rtv_Map *rtv_map = NULL;

	rtv_map = (Rtv_Map *)DATA_GET(global_data,"rtv_map");

	if (!rtv_map)
	{
		EXIT();
		return;
	}
	/* Create the store for the combo, with severla hidden values
	*/
	store = gtk_list_store_new(UO_COMBO_COLS,
			G_TYPE_STRING,	/* Choice */
			G_TYPE_UCHAR,	/* BITval */
			G_TYPE_POINTER,	/* FromECU Multiplier (gfloat *) */
			G_TYPE_POINTER,	/* FromECU Adder (gfloat *) */
			G_TYPE_STRING,	/* Raw Lower clamp limit */
			G_TYPE_STRING,	/* Raw Upper clamp limit */
			G_TYPE_STRING,	/* Range widget string (non temp ctrls) */
			G_TYPE_STRING,	/* Range widget string (Celsius) */
			G_TYPE_STRING,	/* Range widget string (Fahrenheit) */
			G_TYPE_STRING,	/* Range widget string (Kelvin) */
			G_TYPE_INT,		/* Size enumeration (_U08_, _U16_, etc.) */
			G_TYPE_UCHAR,	/* Precision (floating point precision) */
			G_TYPE_BOOLEAN);/* Temp dependent flag */

	/* Iterate across valid variables */
	for (i=0;i<rtv_map->rtv_list->len;i++)
	{
		object = NULL;
		name = NULL;
		object = (gconstpointer *)g_ptr_array_index(rtv_map->rtv_list,i);
		if (!object)
			continue;
		name = (gchar *) DATA_GET(object,"dlog_gui_name");
		if (!name)
			continue;
		if (DATA_GET(object,"fromecu_complex"))
			continue;
		if (DATA_GET(object,"special"))
			continue;
		internal_names = (gchar *) DATA_GET(object,"internal_names");
		if (!find_in_list(rtv_map->raw_list,internal_names))
			continue;

		temp_dep = (GBOOLEAN)DATA_GET(object,"temp_dep");
		size = (DataSize)(GINT)DATA_GET(object,"size");
		multiplier = (gfloat *)DATA_GET(object,"fromecu_mult");
		adder = (gfloat *)DATA_GET(object,"fromecu_add");
		precision = (GINT) DATA_GET(object,"precision");
		bitval = (GINT) DATA_GET(object,"offset");
		if (DATA_GET(object,"real_lower"))
		{
			lower = (gchar *)DATA_GET(object,"real_lower");
			real_lower = g_strtod(lower,NULL);
			raw_lower = calc_value_f(real_lower,multiplier,adder,TOECU);
		}
		else
			raw_lower = get_extreme_from_size_f(size,LOWER);
		if (DATA_GET(object,"real_upper"))
		{
			upper = (gchar *)DATA_GET(object,"real_upper");
			real_upper = g_strtod(upper,NULL);
			raw_upper = calc_value_f(real_upper,multiplier,adder,TOECU);
		}
		else
			raw_upper = get_extreme_from_size_f(size,UPPER);

		range = g_strdup_printf("Valid Range: %.1f <-> %.1f",real_lower,real_upper);
		if (temp_dep)
		{
			tempc_range = g_strdup_printf("Valid Range: %.1f\302\260C <-> %.1f\302\260C",f_to_c_f(real_lower),f_to_c_f(real_upper));
			tempf_range = g_strdup_printf("Valid Range: %.1f\302\260F <-> %.1f\302\260F",real_lower,real_upper);
			tempk_range = g_strdup_printf("Valid Range: %.1f\302\260K <-> %.1f\302\260K",f_to_k_f(real_lower),f_to_k_f(real_upper));
		}
		else
		{
			tempc_range = g_strdup(range);
			tempf_range = g_strdup(range);
			tempk_range = g_strdup(range);
		}
		raw_lower_str = g_strdup_printf("%i",raw_lower);
		raw_upper_str = g_strdup_printf("%i",raw_upper);

		gtk_list_store_append(store,&iter);
		gtk_list_store_set(store,&iter,
				UO_CHOICE_COL,name,
				UO_BITVAL_COL,bitval,
				UO_FROMECU_MULT_COL,multiplier,
				UO_FROMECU_ADD_COL,adder,
				UO_RAW_LOWER_COL,raw_lower_str,
				UO_RAW_UPPER_COL,raw_upper_str,
				UO_RANGE_COL,range,
				UO_RANGE_TEMPC_COL,tempc_range,
				UO_RANGE_TEMPF_COL,tempf_range,
				UO_RANGE_TEMPK_COL,tempk_range,
				UO_SIZE_COL,size,
				UO_PRECISION_COL,precision,
				UO_TEMP_DEP_COL,temp_dep,
				-1);
		g_free(raw_lower_str);
		g_free(raw_upper_str);
		g_free(range);
		g_free(tempc_range);
		g_free(tempf_range);
		g_free(tempk_range);
	}
	if (GTK_IS_COMBO_BOX_ENTRY(widget))
	{
		gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(widget),UO_CHOICE_COL);
		gtk_combo_box_set_model(GTK_COMBO_BOX(widget),GTK_TREE_MODEL(store));
		g_object_unref(store);
		entry = gtk_bin_get_child(GTK_BIN(widget));
		/* Nasty hack, but otherwise the entry is an obnoxious size.. */
		if ((width = (GINT)OBJ_GET((GtkWidget *)widget,"max_chars")) > 0)
			gtk_entry_set_width_chars(GTK_ENTRY(entry),width);
		else
			gtk_entry_set_width_chars(GTK_ENTRY(entry),12);

		gtk_widget_set_size_request(GTK_WIDGET(widget),-1,(3*(GINT)DATA_GET(global_data,"font_size")));

		//		gtk_container_remove (GTK_CONTAINER (widget), gtk_bin_get_child(GTK_BIN(widget)));
		//		gtk_container_add (GTK_CONTAINER (widget), entry);

		completion = gtk_entry_completion_new();
		gtk_entry_set_completion(GTK_ENTRY(entry),completion);
		g_object_unref(completion);
		gtk_entry_completion_set_model(completion,GTK_TREE_MODEL(store));
		gtk_entry_completion_set_text_column(completion,UO_CHOICE_COL);
		gtk_entry_completion_set_inline_completion(completion,TRUE);
		gtk_entry_completion_set_inline_selection(completion,TRUE);
		gtk_entry_completion_set_popup_single_match(completion,FALSE);
		OBJ_SET(widget,"arrow-size",GINT_TO_POINTER(1));
	}
	EXIT();
	return;
}
static void
hildon_find_toolbar_init                        (HildonFindToolbar *self)
{
    GtkToolItem *label_container;
    GtkToolItem *entry_combo_box_container;
    GtkAlignment *alignment;

    HildonFindToolbarPrivate *priv = HILDON_FIND_TOOLBAR_GET_PRIVATE (self);
    g_assert (priv);

    /* Create the label */
    priv->label = gtk_label_new (_("ecdg_ti_find_toolbar_label"));

    gtk_misc_set_padding (GTK_MISC (priv->label), FIND_LABEL_XPADDING,
            FIND_LABEL_YPADDING);

    label_container = gtk_tool_item_new ();
    gtk_container_add (GTK_CONTAINER (label_container), 
            priv->label);

    gtk_widget_show_all (GTK_WIDGET (label_container));
    gtk_toolbar_insert (GTK_TOOLBAR (self), label_container, -1);

    /* ComboBoxEntry for search prefix string / history list */
    priv->entry_combo_box = GTK_COMBO_BOX_ENTRY (gtk_combo_box_entry_new ());

#ifdef MAEMO_GTK
    g_signal_connect (hildon_find_toolbar_get_entry(priv),
            "invalid_input", 
            G_CALLBACK(hildon_find_toolbar_emit_invalid_input), self);
#endif

    entry_combo_box_container = gtk_tool_item_new ();
    alignment = GTK_ALIGNMENT (gtk_alignment_new (0, 0.5, 1, 0));

    gtk_tool_item_set_expand (entry_combo_box_container, TRUE);
    gtk_container_add (GTK_CONTAINER (alignment),
            GTK_WIDGET (priv->entry_combo_box));
    gtk_container_add (GTK_CONTAINER (entry_combo_box_container),
            GTK_WIDGET (alignment));
    gtk_widget_show_all(GTK_WIDGET (entry_combo_box_container));
    gtk_toolbar_insert (GTK_TOOLBAR (self), entry_combo_box_container, -1);
    g_signal_connect (hildon_find_toolbar_get_entry (priv),
            "activate",
            G_CALLBACK(hildon_find_toolbar_entry_activate), self);

    /* Find button */
    priv->find_button = gtk_tool_button_new (
            gtk_image_new_from_icon_name ("qgn_toolb_browser_gobutton",
                HILDON_ICON_SIZE_TOOLBAR),
            "Find");

    g_signal_connect (priv->find_button, "clicked",
            G_CALLBACK(hildon_find_toolbar_emit_search), self);
    gtk_widget_show_all( GTK_WIDGET(priv->find_button));
    gtk_toolbar_insert ( GTK_TOOLBAR(self), priv->find_button, -1);
    gtk_widget_set_size_request (GTK_WIDGET (priv->find_button), 72, -1);
    if ( GTK_WIDGET_CAN_FOCUS( GTK_BIN(priv->find_button)->child) )
        GTK_WIDGET_UNSET_FLAGS(
                GTK_BIN(priv->find_button)->child, GTK_CAN_FOCUS);

    /* Separator */
    priv->separator = gtk_separator_tool_item_new();
    gtk_widget_show(GTK_WIDGET(priv->separator));
    gtk_toolbar_insert (GTK_TOOLBAR(self), priv->separator, -1);

    /* Close button */
    priv->close_button = gtk_tool_button_new (
            gtk_image_new_from_icon_name ("qgn_toolb_gene_close",
                HILDON_ICON_SIZE_TOOLBAR),
            "Close");
    gtk_widget_set_size_request (GTK_WIDGET (priv->close_button), 72, -1);
    g_signal_connect(priv->close_button, "clicked",
            G_CALLBACK(hildon_find_toolbar_emit_close), self);
    gtk_widget_show_all(GTK_WIDGET(priv->close_button));
    gtk_toolbar_insert (GTK_TOOLBAR(self), priv->close_button, -1);
    if ( GTK_WIDGET_CAN_FOCUS( GTK_BIN(priv->close_button)->child) )
        GTK_WIDGET_UNSET_FLAGS(
                GTK_BIN(priv->close_button)->child, GTK_CAN_FOCUS);
}
Example #28
0
/*!
  \brief Sets up a megatunix comboboxentry widget. Reads the data from the 
  passed ConfigFile *, and sets up the choices as well as the combo model
  and an entry completion/regex alloing textual based entry.
  \param object is the pointer to combo widget object
  \param cfgfile is the pointer to datamap file assocated with this widget
  \param section is the section within the cfgfile
  */
G_MODULE_EXPORT void combo_setup(GObject *object, ConfigFile *cfgfile, gchar * section)
{
	gchar *tmpbuf = NULL;
	gchar ** choices = NULL;
	gchar ** vector = NULL;
	gint num_choices = 0;
	gint num_bitvals = 0;
	gint i = 0;
	gchar *tmpstr = NULL;
	gchar *regex = NULL;
	const gchar *name = NULL;
	GtkListStore *store = NULL;
	GtkTreeIter iter;
	GtkEntryCompletion *completion = NULL;
	GtkWidget *entry = NULL;
	extern gconstpointer *global_data;

	cfg_read_string(cfgfile,section,"choices",&tmpbuf);

	choices = parse_keys(tmpbuf,&num_choices,",");
	tmpbuf = g_strdelimit(tmpbuf,",",'|');
	tmpstr = g_utf8_normalize(tmpbuf,-1,G_NORMALIZE_DEFAULT);
	regex = g_utf8_casefold(tmpbuf,-1);
	g_free(tmpbuf);
	g_free(tmpstr);

	if (!cfg_read_string(cfgfile,section,"bitvals",&tmpbuf))
	{
		MTXDBG(CRITICAL,_("\"bitvals\" key is MISSING, critical fault, not setting up control \n"));
		return;
	}
	vector = parse_keys(tmpbuf,&num_bitvals,",");
	g_free(tmpbuf);
	if (num_bitvals != num_choices)
	{
		name = glade_get_widget_name(GTK_WIDGET(object));
		MTXDBG(CRITICAL,_("\"bitvals\" BIG PROBLEM, combobox %s choices %i and bits %i don't match up\n"),(name == NULL ? "undefined" : name),num_choices,num_bitvals);
		return;
	}


	store = gtk_list_store_new(COMBO_COLS,G_TYPE_STRING,G_TYPE_UCHAR);

	for (i=0;i<num_choices;i++)
	{
		gtk_list_store_append(store,&iter);
		assert(choices[i]);
		assert(vector[i]);
		gtk_list_store_set(store,&iter,CHOICE_COL,choices[i],BITVAL_COL,(guchar)g_ascii_strtoull(vector[i],NULL,10),-1);

	}
	OBJ_SET_FULL(object,"model",store,gtk_list_store_clear);
	g_strfreev(vector);
	g_strfreev(choices);

	gtk_combo_box_set_model(GTK_COMBO_BOX(object),GTK_TREE_MODEL(store));
	if (GTK_IS_COMBO_BOX_ENTRY(object))
	{
		gint width = 0;
		gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(object),CHOICE_COL);
		entry = mask_entry_new_with_mask(regex);
		/* Nasty hack, but otherwise the entry is an obnoxious size.. */
		if ((width = (GINT)OBJ_GET((GtkWidget *)object,"max_chars")) > 0)
			gtk_entry_set_width_chars(GTK_ENTRY(entry),width);
		else
			gtk_entry_set_width_chars(GTK_ENTRY(entry),12);

		gtk_widget_set_size_request(GTK_WIDGET(object),-1,(3*(GINT)DATA_GET(global_data,"font_size")));

		gtk_container_remove (GTK_CONTAINER (object), gtk_bin_get_child(GTK_BIN (object)));
		gtk_container_add (GTK_CONTAINER (object), entry);

		completion = gtk_entry_completion_new();
		OBJ_SET_FULL(object,"completion",completion,g_object_unref);
		gtk_entry_set_completion(GTK_ENTRY(entry),completion);
		gtk_entry_completion_set_model(completion,GTK_TREE_MODEL(store));
		gtk_entry_completion_set_text_column(completion,CHOICE_COL);
		gtk_entry_completion_set_inline_completion(completion,TRUE);
		gtk_entry_completion_set_inline_selection(completion,TRUE);
		gtk_entry_completion_set_popup_single_match(completion,FALSE);
		OBJ_SET(object,"arrow-size",GINT_TO_POINTER(1));
	}
	g_free(regex);

}
static void
wifi_private_init (CEPageWifi *self)
{
	CEPageWifiPrivate *priv = CE_PAGE_WIFI_GET_PRIVATE (self);
	GtkBuilder *builder;
	GtkWidget *widget;
	GtkWidget *align;
	GtkLabel *label;

	builder = CE_PAGE (self)->builder;

	priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);

	priv->ssid     = GTK_ENTRY (GTK_WIDGET (gtk_builder_get_object (builder, "wifi_ssid")));
	priv->cloned_mac = GTK_ENTRY (GTK_WIDGET (gtk_builder_get_object (builder, "wifi_cloned_mac")));
	priv->mode     = GTK_COMBO_BOX (GTK_WIDGET (gtk_builder_get_object (builder, "wifi_mode")));
	priv->band     = GTK_COMBO_BOX (GTK_WIDGET (gtk_builder_get_object (builder, "wifi_band")));
	priv->channel  = GTK_SPIN_BUTTON (GTK_WIDGET (gtk_builder_get_object (builder, "wifi_channel")));

	/* BSSID */
#if GTK_CHECK_VERSION(2,24,0)
	priv->bssid = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new_with_entry ());
	gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (priv->bssid), 0);
#else
	priv->bssid = GTK_COMBO_BOX_ENTRY (gtk_combo_box_entry_new_text ());
	gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (priv->bssid), 0);
#endif
	gtk_widget_set_tooltip_text (GTK_WIDGET (priv->bssid),
	                             _("This option locks this connection to the Wi-Fi access point (AP) specified by the BSSID entered here.  Example: 00:11:22:33:44:55"));

	align = GTK_WIDGET (gtk_builder_get_object (builder, "wifi_bssid_alignment"));
	gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (priv->bssid));
	gtk_widget_show_all (GTK_WIDGET (priv->bssid));

	/* Device MAC */
#if GTK_CHECK_VERSION(2,24,0)
	priv->device_mac = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new_with_entry ());
	gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (priv->device_mac), 0);
#else
	priv->device_mac = GTK_COMBO_BOX_ENTRY (gtk_combo_box_entry_new_text ());
	gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (priv->device_mac), 0);
#endif
	gtk_widget_set_tooltip_text (GTK_WIDGET (priv->device_mac),
	                             _("This option locks this connection to the network device specified by its permanent MAC address entered here.  Example: 00:11:22:33:44:55"));

	align = GTK_WIDGET (gtk_builder_get_object (builder, "wifi_device_mac_alignment"));
	gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (priv->device_mac));
	gtk_widget_show_all (GTK_WIDGET (priv->device_mac));

	/* Set mnemonic widget for device MAC label */
	label = GTK_LABEL (GTK_WIDGET (gtk_builder_get_object (builder, "wifi_device_mac_label")));
	gtk_label_set_mnemonic_widget (label, GTK_WIDGET (priv->device_mac));

	priv->rate     = GTK_SPIN_BUTTON (GTK_WIDGET (gtk_builder_get_object (builder, "wifi_rate")));
	widget = GTK_WIDGET (gtk_builder_get_object (builder, "rate_units"));
	gtk_size_group_add_widget (priv->group, widget);

	priv->tx_power = GTK_SPIN_BUTTON (GTK_WIDGET (gtk_builder_get_object (builder, "wifi_tx_power")));
	widget = GTK_WIDGET (gtk_builder_get_object (builder, "tx_power_units"));
	gtk_size_group_add_widget (priv->group, widget);

	priv->mtu      = GTK_SPIN_BUTTON (GTK_WIDGET (gtk_builder_get_object (builder, "wifi_mtu")));
	widget = GTK_WIDGET (gtk_builder_get_object (builder, "mtu_units"));
	gtk_size_group_add_widget (priv->group, widget);
}
Example #30
0
/*
** set widgets contents from the selected account
*/
static void defarchive_set(GtkWidget *widget, gpointer user_data)
{
struct defarchive_data *data;
GtkTreeSelection *selection;
GtkTreeModel		 *model;
GtkTreeIter			 iter;

Archive *item;

	DB( g_printf("(defarchive) set\n") );

	data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");

	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->LV_arc));
	//if true there is a selected node
	if (gtk_tree_selection_get_selected(selection, &model, &iter))
	{
		gtk_tree_model_get(model, &iter, LST_DEFARC_DATAS, &item, -1);


		gtk_entry_set_text(GTK_ENTRY(data->ST_word), item->wording);

		gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->ST_amount), item->amount);

		g_signal_handler_block(data->CM_valid, data->handler_id[HID_VALID]);
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_valid), (item->flags & OF_VALID) ? 1 : 0);
		g_signal_handler_unblock(data->CM_valid, data->handler_id[HID_VALID]);
		
		g_signal_handler_block(data->CM_remind, data->handler_id[HID_REMIND]);
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_remind), (item->flags & OF_REMIND) ? 1 : 0);
		g_signal_handler_unblock(data->CM_remind, data->handler_id[HID_REMIND]);
	
		gtk_combo_box_set_active(GTK_COMBO_BOX(data->NU_mode), item->paymode);

		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_cheque), (item->flags & OF_CHEQ2) ? 1 : 0);

		ui_cat_comboboxentry_set_active(GTK_COMBO_BOX_ENTRY(data->PO_grp), item->category);

	DB( g_print(" -> set payee %d\n", item->payee) );
		ui_pay_comboboxentry_set_active(GTK_COMBO_BOX_ENTRY(data->PO_pay), item->payee);

	DB( g_print(" -> PO_acc %d\n", item->account) );
		ui_acc_comboboxentry_set_active(GTK_COMBO_BOX_ENTRY(data->PO_acc), item->account);

	DB( g_print(" -> PO_accto %d\n", item->dst_account) );
		ui_acc_comboboxentry_set_active(GTK_COMBO_BOX_ENTRY(data->PO_accto), item->dst_account);

		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_auto), (item->flags & OF_AUTO) ? 1 : 0);

		gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_every), item->every);

		gtk_combo_box_set_active(GTK_COMBO_BOX(data->CY_unit), item->unit);

		gtk_dateentry_set_date(GTK_DATE_ENTRY(data->PO_next), item->nextdate);

		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->CM_limit), (item->flags & OF_LIMIT) ? 1 : 0);

		gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->NB_limit), item->limit);

	}

}