Esempio n. 1
0
static void ffmpeg_widget(GtkWidget *w, gpointer data)
{
    int i;
    const char *current_driver;

    g_return_if_fail(GTK_IS_COMBO_BOX(w));

    resources_get_string("FFMPEGFormat", &current_driver);

    i = gtk_combo_box_get_active(GTK_COMBO_BOX(w));
    if (strcmp(buttons[i].driver, "FFMPEG") == 0) {
        GtkListStore *store;
        GtkTreeIter iter;
        int index, found;
        char *drv_name = NULL;

        store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(ffmpeg_omenu)));
        if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) {
            do {
                gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &drv_name, 1, &index, -1);
                found = !strcmp(drv_name, current_driver);
                lib_free(drv_name);
            } while (!found && gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter));
            if (found) {
                selected_driver = current_driver;
                gtk_combo_box_set_active(GTK_COMBO_BOX(ffmpeg_omenu), index);
            }
            gtk_widget_set_sensitive(ffmpg_opts, TRUE);
            return;
        }
    }
    gtk_widget_set_sensitive(ffmpg_opts, FALSE);
}
Esempio n. 2
0
/**
 * xed_encodings_combo_box_set_selected_encoding:
 * @menu:
 * @encoding: (allow-none):
 **/
void
xed_encodings_combo_box_set_selected_encoding (XedEncodingsComboBox *menu,
						 const XedEncoding    *encoding)
{
	GtkTreeIter iter;
	GtkTreeModel *model;
	gboolean b;
	g_return_if_fail (XED_IS_ENCODINGS_COMBO_BOX (menu));
	g_return_if_fail (GTK_IS_COMBO_BOX (menu));

	model = gtk_combo_box_get_model (GTK_COMBO_BOX (menu));
	b = gtk_tree_model_get_iter_first (model, &iter);

	while (b)
	{
		const XedEncoding *enc;

		gtk_tree_model_get (model, &iter,
				    ENCODING_COLUMN, &enc,
				    -1);

		if (enc == encoding)
		{
			gtk_combo_box_set_active_iter (GTK_COMBO_BOX (menu),
						       &iter);

			return;
		}

		b = gtk_tree_model_iter_next (model, &iter);
	}
}
Esempio n. 3
0
void
ol_lrc_engine_list_set_name (GtkWidget *list, 
                             const char *name)
{
  ol_assert (list != NULL);
  ol_assert (GTK_IS_COMBO_BOX (list));
  GtkTreeModel *tree = gtk_combo_box_get_model (GTK_COMBO_BOX (list));
  GtkTreeIter iter;
  gboolean valid = gtk_tree_model_get_iter_first (tree, &iter);
  while (valid)
  {
    char *engine_name = NULL;
    gtk_tree_model_get (tree, &iter,
                        0, &engine_name,
                        -1);
    if (ol_stricmp (engine_name,
                    _(name),
                    strlen (engine_name)) == 0)
    {
      gtk_combo_box_set_active_iter (GTK_COMBO_BOX (list),
                                     &iter);
      g_free (engine_name);
      return;
    }
    g_free (engine_name);
    valid = gtk_tree_model_iter_next (tree, &iter);
  }
}
Esempio n. 4
0
static gboolean
test_widgets_for_current_action (GtkFileChooserDialog *dialog,
				 GtkFileChooserAction  expected_action)
{
  GtkFileChooserDefault *impl;
  gboolean passed;

  if (gtk_file_chooser_get_action (GTK_FILE_CHOOSER (dialog)) != expected_action)
    return FALSE;

  impl = get_impl_from_dialog (GTK_WIDGET (dialog));

  g_assert (impl->action == expected_action);

  passed = TRUE;

  /* OPEN implies that the "new folder" button is hidden; otherwise it is shown */
  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
    passed = passed && !gtk_widget_get_visible (impl->browse_new_folder_button);
  else
    passed = passed && gtk_widget_get_visible (impl->browse_new_folder_button);

  /* Check that the widgets are present/visible or not */
  if (has_action (open_actions, G_N_ELEMENTS (open_actions), impl->action))
    {
      passed = passed && (impl->save_widgets == NULL
			  && (impl->location_mode == LOCATION_MODE_PATH_BAR
			      ? impl->location_entry == NULL
			      : impl->location_entry != NULL)
			  && impl->save_folder_label == NULL
			  && impl->save_folder_combo == NULL
			  && impl->save_expander == NULL
			  && GTK_IS_CONTAINER (impl->browse_widgets) && gtk_widget_is_drawable (impl->browse_widgets));
    }
  else if (has_action (save_actions, G_N_ELEMENTS (save_actions), impl->action))
    {
      /* FIXME: we can't use GTK_IS_FILE_CHOOSER_ENTRY() because it uses
       * _gtk_file_chooser_entry_get_type(), which is a non-exported symbol.
       * So, we just test impl->location_entry for being non-NULL
       */
      passed = passed && (GTK_IS_CONTAINER (impl->save_widgets) && gtk_widget_is_drawable (impl->save_widgets)
			  && impl->location_entry != NULL && gtk_widget_is_drawable (impl->location_entry)
			  && GTK_IS_LABEL (impl->save_folder_label) && gtk_widget_is_drawable (impl->save_folder_label)
			  && GTK_IS_COMBO_BOX (impl->save_folder_combo) && gtk_widget_is_drawable (impl->save_folder_combo)
			  && GTK_IS_EXPANDER (impl->save_expander) && gtk_widget_is_drawable (impl->save_expander)
			  && GTK_IS_CONTAINER (impl->browse_widgets));

      /* FIXME: we are in a SAVE mode; test the visibility and sensitivity of
       * the children that change depending on the state of the expander.
       */
    }
  else
    {
      g_error ("BAD TEST: test_widgets_for_current_action() doesn't know about %s", get_action_name (impl->action));
      passed = FALSE;
    }

  return passed;
}
Esempio n. 5
0
static AtkObject*
get_accessible_for_widget (GtkWidget *widget,
                           gboolean  *transient)
{
  AtkObject *obj = NULL;

  *transient = FALSE;
  if (!widget)
    return NULL;

  if (GTK_IS_ENTRY (widget))
    ;
  else if (GTK_IS_NOTEBOOK (widget)) 
    {
      GtkNotebook *notebook;
      gint page_num = -1;

      notebook = GTK_NOTEBOOK (widget);
      page_num = gtk_notebook_get_current_page (notebook);
      if (page_num != -1)
        {
          obj = gtk_widget_get_accessible (widget);
          obj = atk_object_ref_accessible_child (obj, page_num);
          g_object_unref (obj);
        }
    }
  else if (GTK_IS_TOGGLE_BUTTON (widget))
    {
      GtkWidget *other_widget = gtk_widget_get_parent (widget);
      if (GTK_IS_COMBO_BOX (other_widget))
        {
          gail_set_focus_widget (other_widget, widget);
          widget = other_widget;
        }
    }
  if (obj == NULL)
    {
      AtkObject *focus_object;

      obj = gtk_widget_get_accessible (widget);
      focus_object = g_object_get_qdata (G_OBJECT (obj), quark_focus_object);
      /*
       * We check whether the object for this focus_object has been deleted.
       * This can happen when navigating to an empty directory in nautilus. 
       * See bug #141907.
       */
      if (ATK_IS_GOBJECT_ACCESSIBLE (focus_object))
        {
          if (!atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (focus_object)))
            focus_object = NULL;
        }
      if (focus_object)
        obj = focus_object;
    }

  return obj;
}
Esempio n. 6
0
/* When Modulation Select changed, show relevant modulation routing */
gboolean
on_Modulation_Select_changed(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
  struct match match;
  const char *id = gtk_buildable_get_name(GTK_BUILDABLE(widget));
  if (!id) return;
  if (!GTK_IS_COMBO_BOX(widget)) return;
  int select = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));

  /* Now mangle parameter name (= widget id) to something matchable */
  /* The name of our widget is something like "Modulation Select", whereas
   * the names of the widgets we want to hide/show are like
   * "Modulation 1 Amount". So we grab 'Modulation' and use it to match
   * against the child widgets to see which ones are interesting at all
   * (several of them will be things like labels etc), and use
   * the value of the combobox to match the actual Modulation route number. */

  /* We generate a 'prefix' string which is the first word of the
   * parameter, including the following space, e.g. "Modulation ". */

  /* Need to make copy of string in order to modify it. */
  char prefix[strlen(id) + 1];
  strcpy(prefix, id);
  /* Find end of first word, normally Modulation */
  char *find = prefix;
  while (*find && *find++ != ' ')
    ;
  if (!*find) return; /* end of string found before end of first word,
                         or no suffix, i.e. id is just "Modulation " */
  *find = '\0'; /* terminate it: we now have "Modulation " */

  match.prefix = prefix;
  match.select = select + 1; /* Assume routes start at 1, i.e. "Modulation 1" */

  /* Now show/hide all children of parent container: Show the parameter
   * with matching (first part of) name and number, and hide the others. */

  /* Actually, we cheat a bit here, we just scan all children of the
   * immediate parent, which is fine for the modulation where all the
   * step widgets are in the same box; on a more global scale we'd have
   * to start at the top window, and recursively scan every container we
   * find. However, since we have two modulation routings, we couldn't go
   * that high in the object hierarchy, or we would show/hide the routings
   * for both modulation boxes. */
  GtkWidget *container = gtk_widget_get_parent(GTK_WIDGET(widget));
  GList *container_children = gtk_container_get_children(GTK_CONTAINER(container));

  g_list_foreach(container_children, show_hide, &match);

  /* Finally, any knob mappings related to the modulation selected must be
   * redone to correspond with the mappings now visible. */
  invalidate_knob_mappings(container);

  return FALSE;
}
static void
combo_changed (GtkWidget *widget, NewTaxTable *ntt)
{
    gint index;

    g_return_if_fail(GTK_IS_COMBO_BOX(widget));
    g_return_if_fail(ntt);

    index = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
    ntt->type = index + 1;
}
Esempio n. 8
0
static GtkTreeModel *
gtk_cell_layout_get_model (GtkCellLayout *layout)
{
  if (GTK_IS_TREE_VIEW_COLUMN (layout))
    return gtk_tree_view_get_model (GTK_TREE_VIEW (gtk_tree_view_column_get_tree_view (GTK_TREE_VIEW_COLUMN (layout))));
  else if (GTK_IS_ICON_VIEW (layout))
    return gtk_icon_view_get_model (GTK_ICON_VIEW (layout));
  else if (GTK_IS_COMBO_BOX (layout)) 
    return gtk_combo_box_get_model (GTK_COMBO_BOX (layout));
  else
    return NULL;
}
void AP_UnixDialog_Paragraph::event_ComboBoxChanged(GtkWidget * widget)
{
	UT_ASSERT(widget && GTK_IS_COMBO_BOX(widget));

	
	tControl id = (tControl) GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget),
								   WIDGET_ID_TAG));

	UT_uint32 value = (UT_uint32)XAP_comboBoxGetActiveInt(GTK_COMBO_BOX(widget));

	_setMenuItemValue(id, value);
}
Esempio n. 10
0
void
go_gtk_combo_box_append_text (GtkComboBox *combo, char const *str)
{
	GtkListStore *model;
	GtkTreeIter iter;

	g_return_if_fail (GTK_IS_COMBO_BOX (combo));
	g_return_if_fail (str != NULL);

	model = GTK_LIST_STORE (gtk_combo_box_get_model (combo));
	gtk_list_store_append (model, &iter);
	gtk_list_store_set (model, &iter, 0, str, -1);
}
Esempio n. 11
0
static void _nojs_preferences_on_policy_editing_started(NoJSPreferences *self,
															GtkCellEditable *editable,
															gchar *path,
															gpointer *inUserData)
{
	NoJSPreferencesPrivate	*priv=self->priv;

	priv->editingCombo=NULL;

	if(!GTK_IS_COMBO_BOX(editable)) return;

	priv->editingCombo=GTK_WIDGET(editable);
}
Esempio n. 12
0
G_MODULE_EXPORT void started(GtkCellRenderer *renderer, GtkCellEditable *editable, gchar *path, gpointer data)
{
	printf("combo editing-started signal!\n");
	if (GTK_IS_ENTRY(editable))
		printf("Its an entry\n");
	else if (GTK_IS_COMBO_BOX(editable))
	{
		printf("Its a combo box\n");
		g_signal_emit_by_name(editable,"popup");
	}
	else
		printf("Not sure what widget this is...\n");
}
Esempio n. 13
0
static void
panel_dialogs_choose_panel_combo_changed (GtkComboBox      *combo,
                                          PanelApplication *application)
{
  gint idx;

  panel_return_if_fail (PANEL_IS_APPLICATION (application));
  panel_return_if_fail (GTK_IS_COMBO_BOX (combo));

  /* select active panel */
  idx = gtk_combo_box_get_active (combo);
  panel_application_window_select (application,
      panel_application_get_nth_window (application, idx));
}
Esempio n. 14
0
const char *
ol_lrc_engine_list_get_name (GtkWidget *list)
{
  ol_assert_ret (list != NULL, NULL);
  ol_assert_ret (GTK_IS_COMBO_BOX (list), NULL);
  int index = gtk_combo_box_get_active (GTK_COMBO_BOX (list));
  int count = 0;
  const char **engine_list = ol_lrc_fetch_get_engine_list (&count);
  if (engine_list != NULL && index < count)
  {
    return engine_list[index];
  }
  return NULL;
}
Esempio n. 15
0
static void 
enumprop_set_from_widget(EnumProperty *prop, WIDGET *widget) 
{
  if (GTK_IS_COMBO_BOX (widget)) {
    guint pos = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
    PropEnumData *enumdata = prop->common.extra_data;
    
    g_return_if_fail (enumdata != NULL);
    
    prop->enum_data = enumdata[pos].enumv;
  } else {
    prop->enum_data = strtol(gtk_entry_get_text(GTK_ENTRY(widget)), NULL, 0);
  }
}
Esempio n. 16
0
/** Connect a GtkComboBox widget to its stored value in the preferences database.
 *
 *  @internal
 *
 *  @param box A pointer to the combo box that should be connected.
 */
static void
gnc_prefs_connect_combo_box (GtkComboBox *box)
{
    gchar *group, *pref;

    g_return_if_fail(GTK_IS_COMBO_BOX(box));

    gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(box)), &group, &pref);

    gnc_prefs_bind (group, pref, G_OBJECT (box), "active");

    g_free (group);
    g_free (pref);
}
Esempio n. 17
0
void createMPQCGuess(GtkWidget *box)
{
	GtkWidget* frame;
	GtkWidget* vboxFrame;
	GtkWidget* vboxTable;
	GtkWidget* hboxButton;
	GtkWidget* comboSpinMultiplicity = NULL;
	GtkWidget* comboCharge = NULL;
	GtkWidget *table = NULL;
	GtkWidget *checkButton = NULL;
	gint i;

	table = gtk_table_new(5,4,FALSE);

	frame = gtk_frame_new (_("Parameters for computing the guess wave function"));
	gtk_widget_show (frame);
	gtk_box_pack_start (GTK_BOX (box), frame, TRUE, TRUE, 3);
	gtk_frame_set_label_align (GTK_FRAME (frame), 0.5, 0.5);

	vboxFrame = gtk_vbox_new (FALSE, 3);
	gtk_widget_show (vboxFrame);
	gtk_container_add (GTK_CONTAINER (frame), vboxFrame);

	hboxButton = gtk_hbox_new(TRUE, 5);
	gtk_box_pack_start (GTK_BOX (vboxFrame), hboxButton, FALSE, FALSE, 5);

	checkButton = gtk_check_button_new_with_label (_("Starting from core Hamiltonian guess."));
	gtk_box_pack_start (GTK_BOX (hboxButton), checkButton, TRUE, TRUE, 5);

	vboxTable = gtk_vbox_new (FALSE, 3);
	gtk_box_pack_start (GTK_BOX (vboxFrame), vboxTable, TRUE, TRUE, 3);

	gtk_box_pack_start (GTK_BOX (vboxTable), table, TRUE, TRUE, 0);

	i = 0;
	comboCharge = addMPQCChargeToTable(table, i);
	i = 1;
	comboSpinMultiplicity = addMPQCSpinGuessToTable(table, i);

	if(GTK_IS_COMBO_BOX(comboCharge))
		g_object_set_data(G_OBJECT (GTK_BIN(comboCharge)->child), "ComboSpinMultiplicity", comboSpinMultiplicity);

	i = 2;
	addMPQCMethodToTable(table, i, comboSpinMultiplicity);
	i = 3;
	addMPQCBasisGuessToTable(table,i);

	g_object_set_data(G_OBJECT (checkButton), "VboxTable", vboxTable);
	g_signal_connect(G_OBJECT(checkButton),"clicked", G_CALLBACK(coreButtonClicked),NULL);
}
Esempio n. 18
0
static void datasource_url_get_cmd_string ( datasource_url_widgets_t *widgets, gchar **cmd, gchar **input_file_type, DownloadMapOptions *options )
{
	// Retrieve the user entered value
	const gchar *value = gtk_entry_get_text ( GTK_ENTRY(widgets->url) );

	if (GTK_IS_COMBO_BOX (widgets->type) )
		last_type = gtk_combo_box_get_active ( GTK_COMBO_BOX (widgets->type) );

	*input_file_type = NULL; // Default to gpx
	if ( a_babel_file_list )
		*input_file_type = g_strdup ( ((BabelFile*)g_list_nth_data (a_babel_file_list, last_type))->name );

	*cmd = g_strdup ( value );
	options = NULL;
}
Esempio n. 19
0
File: ui.c Progetto: scorpp/db-vk
static void
save_active_property_value_to_config (GtkWidget *widget, gpointer data) {
    GValue value = G_VALUE_INIT;

    if (GTK_IS_COMBO_BOX (widget)) {
        g_value_init (&value, G_TYPE_INT);
    } else if (GTK_IS_CHECK_BUTTON (widget)) {
        g_value_init (&value, G_TYPE_BOOLEAN);
    } else {
        trace ("FATAL: %s unsupported widget type\n", __FUNCTION__);
    }

    g_object_get_property (G_OBJECT (widget), "active", &value);
    vk_set_config_var ((const gchar *) data, &value);
}
Esempio n. 20
0
static void
sample_combo_changed (GtkComboBox *combo,
                      FilterData  *filter_data)
{
  GtkTreeIter iter;
  gint sample_num;

  g_assert (GTK_IS_COMBO_BOX (combo));
  g_assert (filter_data != NULL);

  if (gtk_combo_box_get_active_iter (combo, &iter))
    {
      gtk_tree_model_get (GTK_TREE_MODEL (filter_data->sample_store), &iter, 0, &sample_num, -1);
      setup_sample (filter_data, sample_num);
    }
}
Esempio n. 21
0
static void
on_gsettings_changed (GSettings *settings,
                      gchar     *key,
                      GtkWidget *widget)
{
  if (GTK_IS_SWITCH (widget))
  {
    gboolean active1 = g_settings_get_boolean (settings, key);
    gboolean active2 = gtk_switch_get_active (GTK_SWITCH (widget));

    if (active1 != active2)
      gtk_switch_set_active (GTK_SWITCH (widget), active1);
  }
  else if (GTK_IS_COMBO_BOX (widget))
  {
    gchar    *id;
    gboolean  retval;

    id = g_settings_get_string (settings, key);
    retval = gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget), id);

    if (retval == FALSE && g_strcmp0 (key, "default-engine") == 0)
      g_settings_set_string (settings, key, "nimf-system-keyboard");

    g_free (id);
  }
  else if (GTK_IS_TREE_VIEW (widget))
  {
    GtkTreeModel  *model;
    gchar        **vals;
    GtkTreeIter    iter;
    gint           i;

    vals = g_settings_get_strv (settings, key);
    model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
    gtk_list_store_clear (GTK_LIST_STORE (model));

    for (i = 0; vals[i] != NULL; i++)
    {
      gtk_list_store_append (GTK_LIST_STORE (model), &iter);
      gtk_list_store_set    (GTK_LIST_STORE (model), &iter, 0, vals[i], -1);
    }

    g_strfreev (vals);
  }
}
static void
mode_changed (GstyleColorPlane *self,
              GtkComboBox      *mode_box)
{
  GtkTreeIter iter;
  GtkTreeModel *mode_store;
  GstyleColorPlaneMode mode;

  g_assert (GSTYLE_IS_COLOR_PLANE (self));
  g_assert (GTK_IS_COMBO_BOX (mode_box));

  mode_store = gtk_combo_box_get_model (mode_box);
  if (gtk_combo_box_get_active_iter (mode_box, &iter))
    {
      gtk_tree_model_get (mode_store, &iter, 0, &mode, -1);
      gstyle_color_plane_set_mode (self, mode);
    }
}
Esempio n. 23
0
static void datasource_url_get_process_options ( datasource_url_widgets_t *widgets, ProcessOptions *po, DownloadFileOptions *download_options, const gchar *not_used2, const gchar *not_used3 )
{
	// Retrieve the user entered value
	const gchar *value = gtk_entry_get_text ( GTK_ENTRY(widgets->url) );

	if (GTK_IS_COMBO_BOX (widgets->type) )
		last_type = gtk_combo_box_get_active ( GTK_COMBO_BOX (widgets->type) );

	po->input_file_type = NULL; // Default to gpx
	if ( a_babel_file_list )
		po->input_file_type = g_strdup ( ((BabelFile*)g_list_nth_data (a_babel_file_list, last_type))->name );

	po->url = g_strdup ( value );

	// Support .zip + bzip2 files directly
	download_options->convert_file = a_try_decompress_file;
	download_options->follow_location = 5;
}
Esempio n. 24
0
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_get_entry_text_column (
							   GTK_COMBO_BOX (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);
}
Esempio n. 25
0
/** Connect a GtkComboBox widget to its stored value in the preferences database.
 *
 *  @internal
 *
 *  @param box A pointer to the combo box that should be connected.
 */
static void
gnc_prefs_connect_combo_box (GtkComboBox *box)
{
    gchar *group, *pref;
    gint active;

    g_return_if_fail(GTK_IS_COMBO_BOX(box));

    gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(box)), &group, &pref);

//    active = gnc_prefs_get_int(group, pref);
//    gtk_combo_box_set_active(GTK_COMBO_BOX(box), active);
//    DEBUG(" Combo box %s/%s set to item %d", group, pref, active);

    gnc_prefs_bind (group, pref, G_OBJECT (box), "active");

    g_free (group);
    g_free (pref);
}
Esempio n. 26
0
/* Add widget to map for container */
static void *
blofeld_knobs_container_add_widget(void *knobmap_in,
                                   struct knob_descriptor *knob_description)
{
  struct knobmap *knobmap = knobmap_in;

  if (!knob_description) return knobmap;

  if (GTK_IS_RANGE(knob_description->widget))
    knobmap->pots.build = g_list_prepend(knobmap->pots.build,
                                         knob_description);
  else if (GTK_IS_COMBO_BOX(knob_description->widget))
    knobmap->buttons.build = g_list_prepend(knobmap->buttons.build,
                                            knob_description);
  /* We don't map toggle buttons or check buttons as it messes up the
   * ordering in for example the oscillator frames. */

  return knobmap;
}
Esempio n. 27
0
static GladeWidget *
get_model_widget (GladeWidget * view)
{

  GtkTreeModel *model = NULL;
  GObject      *object = glade_widget_get_object (view);

  if (GTK_IS_TREE_VIEW (object))
    model = gtk_tree_view_get_model (GTK_TREE_VIEW (object));
  else if (GTK_IS_ICON_VIEW (object))
    model = gtk_icon_view_get_model (GTK_ICON_VIEW (object));
  else if (GTK_IS_COMBO_BOX (object))
    model = gtk_combo_box_get_model (GTK_COMBO_BOX (object));

  if (model)
    return glade_widget_get_from_gobject (model);

  return NULL;
}
Esempio n. 28
0
static void
widget_fixups (GtkWidget *widget)
{
  /* post-constructor for widgets that need additional settings to work correctly */
  if (GTK_IS_COMBO_BOX_ENTRY (widget))
    {
      GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);
      g_object_set (widget, "model", store, "text-column", 0, NULL);
      g_object_unref (store);
      gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "test text");
    }
  else if (GTK_IS_COMBO_BOX (widget))
    {
      GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);
      g_object_set (widget, "model", store, NULL);
      g_object_unref (store);
      gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "test text");
    }
}
Esempio n. 29
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;
}
Esempio n. 30
0
/*!
  \brief Called when the user selects an AFR conversion combobox entry
  \param widget is the combobox the user touched
  \param data is unused
  */
G_MODULE_EXPORT void afr_combo_changed(GtkWidget *widget, gpointer data)
{
	gboolean state = FALSE;
	GtkTreeModel *model = NULL;
	GtkTreeIter iter;

	g_return_if_fail(GTK_IS_COMBO_BOX(widget));

	state = gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget),&iter);
	model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
	gtk_tree_model_get(model,&iter,0,&afr_name,1,&afr_enum,-1);
	
	if (afr_enum == genericWB)
		gtk_widget_set_sensitive(OBJ_GET(widget,"generic_controls"),TRUE);
	else
		gtk_widget_set_sensitive(OBJ_GET(widget,"generic_controls"),FALSE);

	return;
}