Ejemplo n.º 1
0
static void
adapt_form_widget (GdauiProviderSpecEditor *spec)
{
	/* destroy any previous widget */
	if (spec->priv->form) {
		gtk_container_foreach (GTK_CONTAINER (spec), (GtkCallback) gtk_widget_destroy, NULL);
		spec->priv->form = NULL;
	}
	spec->priv->type = NO_PROVIDER;
	
	if (!spec->priv->provider) 
		return;
	
	/* fetch DSN parameters */
	GdaProviderInfo *pinfo;
	pinfo = gda_config_get_provider_info (spec->priv->provider);
	if (!pinfo) {
		g_warning (_("Unknown provider '%s'"), spec->priv->provider);
		return;
	}
	if (!pinfo->dsn_params) {
		g_warning (_("Provider '%s' does not report the required parameters for DSN"), spec->priv->provider);
		return;
	}

	/* create new widget */	
	GdaSet *dset;
	dset = gda_set_copy (pinfo->dsn_params);
	if (dset) {
		GtkWidget *wid;	
		spec->priv->type = PROVIDER_FORM;
		
		wid = gdaui_basic_form_new (dset);
		g_object_set ((GObject*) wid, "show-actions", FALSE, NULL);
		g_object_unref (dset);
		
		spec->priv->form = wid;
		if (spec->priv->labels_size_group)
			gdaui_basic_form_add_to_size_group (GDAUI_BASIC_FORM (spec->priv->form), spec->priv->labels_size_group,
							    GDAUI_BASIC_FORM_LABELS);
		if (spec->priv->entries_size_group)
			gdaui_basic_form_add_to_size_group (GDAUI_BASIC_FORM (spec->priv->form), spec->priv->entries_size_group,
							    GDAUI_BASIC_FORM_ENTRIES);
		update_form_contents (spec);
		g_signal_connect (G_OBJECT (wid), "holder-changed",
				  G_CALLBACK (dsn_form_changed), spec);
	
		gtk_widget_show (wid);
		gtk_container_add (GTK_CONTAINER (spec), wid);
	}
}
static void
update_operations (NautilusToolbar *self)
{
        GList *progress_infos;
        GList *l;
        GtkWidget *progress;
        gboolean should_show_progress_button = FALSE;

        gtk_container_foreach (GTK_CONTAINER (self->priv->operations_container),
                               (GtkCallback) gtk_widget_destroy,
                               NULL);

        disconnect_progress_infos (self);

        progress_infos = get_filtered_progress_infos (self);
        for (l = progress_infos; l != NULL; l = l->next) {
                should_show_progress_button = should_show_progress_button ||
                                              should_show_progress_info (l->data);

                g_signal_connect_swapped (l->data, "finished",
		                          G_CALLBACK (on_progress_info_finished), self);
                g_signal_connect_swapped (l->data, "cancelled",
		                          G_CALLBACK (on_progress_info_cancelled), self);
                g_signal_connect_swapped (l->data, "progress-changed",
		                          G_CALLBACK (on_progress_info_progress_changed), self);
                progress = nautilus_progress_info_widget_new (l->data);
                gtk_box_pack_start (GTK_BOX (self->priv->operations_container),
                                    progress,
                                    FALSE, FALSE, 0);
        }

        g_list_free (progress_infos);

        /* Either we are already showing the button, so keep showing it until the user
         * toggle it to hide the operations popover, or, if we want now to show it,
         * we have to have at least one operation that its total stimated time
         * is longer than OPERATION_MINIMUM_TIME seconds, or if we failed to get
         * a correct stimated time and it's around OPERATION_MINIMUM_TIME,
         * showing the button for just for a moment because now we realized the
         * estimated time is longer than a OPERATION_MINIMUM_TIME is odd, so show
         * it only if the remaining time is bigger than again OPERATION_MINIMUM_TIME.
         */
        if (should_show_progress_button &&
            !gtk_revealer_get_reveal_child (GTK_REVEALER (self->priv->operations_revealer))) {
                add_operations_button_attention_style (self);
                gtk_revealer_set_reveal_child (GTK_REVEALER (self->priv->operations_revealer),
                                               TRUE);
                gtk_widget_queue_draw (self->priv->operations_icon);
        }
}
static void
update_child_count (TrayData *data)
{
  guint n_children = 0;
  char text[64];

  if (!gtk_widget_get_realized (GTK_WIDGET (data)))
    return;

  gtk_container_foreach (GTK_CONTAINER (data->box), (GtkCallback) do_add, &n_children);

  g_snprintf (text, sizeof (text), "%u icons", n_children);
  gtk_label_set_text (data->count_label, text);
}
Ejemplo n.º 4
0
static void
update_sidebar (GcalYearView *year_view)
{
  GcalYearViewPrivate *priv = year_view->priv;

  GtkWidget *child_widget;
  GList *events, *l;
  GList **days_widgets_array;
  gint i, days_span;

  update_selected_dates_from_button_data (year_view);

  gtk_container_foreach (GTK_CONTAINER (priv->events_sidebar), (GtkCallback) gtk_widget_destroy, NULL);

  days_span = icaltime_day_of_year(*(priv->end_selected_date)) - icaltime_day_of_year(*(priv->start_selected_date)) + 1;
  days_widgets_array = g_new0 (GList*, days_span);

  events = gcal_manager_get_events (priv->manager, priv->start_selected_date, priv->end_selected_date);
  if (events == NULL)
    {
      days_span = 0;
      update_no_events_page (year_view);
      gtk_stack_set_visible_child_name (GTK_STACK (priv->navigator_stack), "no-events");
    }
  else
    {
      gtk_stack_set_visible_child_name (GTK_STACK (priv->navigator_stack), "events-list");
    }

  for (l = events; l != NULL; l = g_list_next (l))
    add_event_to_day_array (year_view, l->data, days_widgets_array, days_span);

  for (i = 0; i < days_span; i++)
    {
      GList *current_day = days_widgets_array[i];
      for (l = current_day; l != NULL; l = g_list_next (l))
        {
          child_widget = l->data;
          gtk_widget_show (child_widget);
          g_signal_connect (child_widget, "activate", G_CALLBACK (event_activated), year_view);
          g_object_set_data (G_OBJECT (child_widget), "shift", GINT_TO_POINTER (i));
          gtk_container_add (GTK_CONTAINER (priv->events_sidebar), child_widget);
        }

      g_list_free (current_day);
    }

  g_free (days_widgets_array);
  g_list_free_full (events, g_free);
}
Ejemplo n.º 5
0
static void
remove_early_perspectives (IdeWorkbench *self)
{
  g_assert (IDE_IS_WORKBENCH (self));

  if (self->early_perspectives_removed)
    return;

  gtk_container_foreach (GTK_CONTAINER (self->perspectives_stack),
                         do_remove_early_perspectives,
                         NULL);

  self->early_perspectives_removed = TRUE;
}
Ejemplo n.º 6
0
static void SetPage(int32_t n)
{
    if (!gtkenabled || !stwidgets.startwin) return;
    mode = n;
    gtk_notebook_set_current_page(GTK_NOTEBOOK(stwidgets.tabs), n);

    // each control in the config page vertical layout plus the start button should be made (in)sensitive
    if (n == TAB_CONFIG) n = TRUE;
    else n = FALSE;
    gtk_widget_set_sensitive(stwidgets.startbutton, n);
    gtk_container_foreach(GTK_CONTAINER(stwidgets.configtlayout),
                          (GtkCallback)gtk_widget_set_sensitive,
                          (gpointer)&n);
}
Ejemplo n.º 7
0
static void
set_font (GtkWidget *w, gpointer data)
{
  PangoFontDescription *font_desc = data;
  GtkRcStyle *style = gtk_widget_get_modifier_style (w);

  pango_font_description_free (style->font_desc);
  style->font_desc = pango_font_description_copy (font_desc);

  gtk_widget_modify_style (w, style);

  if ( GTK_IS_CONTAINER (w))
    gtk_container_foreach (GTK_CONTAINER (w), set_font, font_desc);
}
Ejemplo n.º 8
0
/*!
  \brief populate_master() stores a pointer to all of the glade loaded 
  widgets into a master hashtable so that it can be recalled by name 
  anywhere in the program.
  \param widget is the pointer to Widget
  \param user_data is the pointer to ConfigFile structure
  */
G_MODULE_EXPORT void populate_master(GtkWidget *widget, gpointer user_data )
{
	gchar *name = NULL;
	gchar *fullname = NULL;
	gchar *prefix = NULL;
	GHashTable *dynamic_widgets = NULL;
	ConfigFile *cfg = (ConfigFile *) user_data;
	/*!
	 Populates a big master hashtable of all dynamic widgets so that 
	 various functions can do a lookup for the widgets name and get it's
	 GtkWidget * for manipulation.  We do NOT insert the topframe
	 widgets from the XML tree as if more than 1 tab loads there will 
	 be a clash, and there's no need to store the top frame widget 
	 anyways...
	 */
	if (GTK_IS_CONTAINER(widget))
		gtk_container_foreach(GTK_CONTAINER(widget),populate_master,user_data);
	if (!cfg_read_string(cfg,"global","id_prefix",&prefix))
		prefix = g_strdup("");

	name = (char *)glade_get_widget_name(widget);
	/*printf("name of widget stored is %s\n",name);*/

	if (name == NULL)
	{
		g_free(prefix);
		return;
	}
	if (g_strrstr((gchar *)name,"topframe"))
	{
		g_free(prefix);
		return;
	}
	dynamic_widgets = DATA_GET(global_data,"dynamic_widgets");
	if(!dynamic_widgets)
	{
		dynamic_widgets = g_hash_table_new_full(g_str_hash,g_str_equal,g_free,NULL);
		DATA_SET_FULL(global_data,"dynamic_widgets",dynamic_widgets,g_hash_table_destroy);
	}
	fullname = g_strdup_printf("%s%s",prefix,name);
	OBJ_SET_FULL(widget,"fullname",g_strdup(fullname),g_free);
	OBJ_SET(widget,"last_value",GINT_TO_POINTER(-G_MAXINT));
	if (!g_hash_table_lookup(dynamic_widgets,fullname))
		g_hash_table_insert(dynamic_widgets,g_strdup(fullname),(gpointer)widget);
	else
		MTXDBG(CRITICAL,_("Key %s  for widget %s from file %s already exists in master table\n"),name,fullname,cfg->filename);

	g_free(prefix);
	g_free(fullname);
}
Ejemplo n.º 9
0
void bar_set_fd(GtkWidget *bar, FileData *fd)
{
	BarData *bd;
	bd = g_object_get_data(G_OBJECT(bar), "bar_data");
	if (!bd) return;

	file_data_unref(bd->fd);
	bd->fd = file_data_ref(fd);

	gtk_container_foreach(GTK_CONTAINER(bd->vbox), bar_pane_set_fd_cb, fd);

	gtk_label_set_text(GTK_LABEL(bd->label_file_name), (bd->fd) ? bd->fd->name : "");

}
Ejemplo n.º 10
0
static void
gtk_shortcuts_window_add_section (GtkShortcutsWindow  *self,
                                  GtkShortcutsSection *section)
{
  GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self);
  GtkListBoxRow *row;
  gchar *title;
  gchar *name;
  const gchar *visible_section;
  GtkWidget *label;

  gtk_container_foreach (GTK_CONTAINER (section), gtk_shortcuts_window_add_search_item, self);

  g_object_get (section,
                "section-name", &name,
                "title", &title,
                NULL);

  g_signal_connect (section, "notify", G_CALLBACK (section_notify_cb), self);

  if (name == NULL)
    name = g_strdup ("shortcuts");

  gtk_stack_add_titled (priv->stack, GTK_WIDGET (section), name, title);

  visible_section = gtk_stack_get_visible_child_name (priv->stack);
  if (strcmp (visible_section, "internal-search") == 0 ||
      (priv->initial_section && strcmp (priv->initial_section, visible_section) == 0))
    gtk_stack_set_visible_child (priv->stack, GTK_WIDGET (section));

  row = g_object_new (GTK_TYPE_LIST_BOX_ROW,
                      "visible", TRUE,
                      NULL);
  g_object_set_data (G_OBJECT (row), "gtk-shortcuts-section", section);
  label = g_object_new (GTK_TYPE_LABEL,
                        "margin", 6,
                        "label", title,
                        "xalign", 0.5f,
                        "visible", TRUE,
                        NULL);
  g_object_set_data (G_OBJECT (section), "gtk-shortcuts-title", label);
  gtk_container_add (GTK_CONTAINER (row), GTK_WIDGET (label));
  gtk_container_add (GTK_CONTAINER (priv->list_box), GTK_WIDGET (row));

  update_title_stack (self);

  g_free (name);
  g_free (title);
}
Ejemplo n.º 11
0
static void change_orient(struct app_t *app, int is_vert)
{
    if (is_vert != app->is_vert) {
	GtkWidget *from, *to, *parent;
	
	app->is_vert = is_vert;
	
	from = app->pack;
	if (is_vert)
	    to = gtk_vbox_new(FALSE, 0);
	else
	    to = gtk_hbox_new(FALSE, 0);
	parent = gtk_widget_get_parent(from);
	
	gtk_container_foreach(GTK_CONTAINER(from), reparent_iter, to);
	gtk_container_foreach(GTK_CONTAINER(to), setvert_iter, GINT_TO_POINTER(is_vert));
	
	app->pack = to;
	
	gtk_box_pack_start(GTK_BOX(parent), to, TRUE, TRUE, 0);
	gtk_widget_destroy(from);
	gtk_widget_show_all(to);
    }
}
static void
_item_active_changed (GtkWidget  *item,
                      GParamSpec *pspec,
                      GtkWidget  *list)
{
  CarrickListPrivate *priv = LIST_PRIVATE (list);

  if (carrick_service_item_get_active (CARRICK_SERVICE_ITEM (item)))
    {
      gtk_container_foreach (GTK_CONTAINER (priv->box),
                             (GtkCallback) _list_collapse_inactive_items,
                             item);
      _set_active_item (CARRICK_LIST (list), item);
    }
}
Ejemplo n.º 13
0
GtkSizeGroup *
gtk_utils_align_left_widgets (GtkContainer *container,
			      GtkSizeGroup *size_group)
{
  g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL);
  g_return_val_if_fail (!size_group || GTK_IS_SIZE_GROUP (size_group), NULL);

  if (!size_group)
    size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);

  gtk_container_foreach (container,
			 (GtkCallback) do_align_left_widgets, size_group);

  return size_group;
}
/* Find throbber of view or browser */
static void _interface_tweaks_find_view_throbber_callback(GtkWidget *inWidget, gpointer inUserData)
{
	g_return_if_fail(GTK_IS_WIDGET(inWidget));

	if(KATZE_IS_THROBBER(inWidget))
	{
		KatzeThrobber	**throbber=(KatzeThrobber**)inUserData;

		if(throbber) *throbber=KATZE_THROBBER(inWidget);
	}
		else if(GTK_IS_CONTAINER(inWidget))
		{
			gtk_container_foreach(GTK_CONTAINER(inWidget), _interface_tweaks_find_view_throbber_callback, inUserData);
		}
}
/* Find close button of view */
static void _interface_tweaks_find_view_close_button_callback(GtkWidget *inWidget, gpointer inUserData)
{
	g_return_if_fail(GTK_IS_WIDGET(inWidget));

	if(g_strcmp0(gtk_widget_get_name(inWidget), "midori-close-button")==0)
	{
		GtkWidget	**closeButton=(GtkWidget**)inUserData;

		if(closeButton) *closeButton=GTK_WIDGET(inWidget);
	}
		else if(GTK_IS_CONTAINER(inWidget))
		{
			gtk_container_foreach(GTK_CONTAINER(inWidget), _interface_tweaks_find_view_close_button_callback, inUserData);
		}
}
static void _interface_tweaks_find_browser_locationbar_callback(GtkWidget *inWidget, gpointer inUserData)
{
	g_return_if_fail(GTK_IS_WIDGET(inWidget));

	if(GTK_IS_TOOL_ITEM(inWidget))
	{
		GtkAction	*action;

		action=gtk_activatable_get_related_action(GTK_ACTIVATABLE(inWidget));
		if(g_strcmp0(gtk_action_get_name(action), "Location")==0)
		{
			InterfaceTweaksLocationbarLookup	**item=(InterfaceTweaksLocationbarLookup**)inUserData;

			if(item) (*item)->action=action;

			gtk_container_foreach(GTK_CONTAINER(inWidget), _interface_tweaks_find_browser_locationbar_entry_callback, inUserData);
		}
			else if(g_strcmp0(gtk_action_get_name(action), "LocationSearch")==0)
			{
				InterfaceTweaksLocationbarLookup	**item=(InterfaceTweaksLocationbarLookup**)inUserData;
				GtkWidget							*locationChild;

				if(item) (*item)->action=action;

				locationChild=midori_paned_action_get_child_by_name(MIDORI_PANED_ACTION(action), "Location");
				if(locationChild)
				{
					gtk_container_foreach(GTK_CONTAINER(locationChild), _interface_tweaks_find_browser_locationbar_entry_callback, inUserData);
				}
			}
	}
		else if(GTK_IS_CONTAINER(inWidget))
		{
			gtk_container_foreach(GTK_CONTAINER(inWidget), _interface_tweaks_find_browser_locationbar_callback, inUserData);
		}
}
/* Find locationbar of browser (and entry of locationbar) */
static void _interface_tweaks_find_browser_locationbar_entry_callback(GtkWidget *inWidget, gpointer inUserData)
{
	g_return_if_fail(GTK_IS_WIDGET(inWidget));

	if(GTK_IS_ENTRY(inWidget))
	{
		InterfaceTweaksLocationbarLookup	**item=(InterfaceTweaksLocationbarLookup**)inUserData;
	
		if(item) (*item)->widget=inWidget;
	}
		else if(GTK_IS_CONTAINER(inWidget))
		{
			gtk_container_foreach(GTK_CONTAINER(inWidget), _interface_tweaks_find_browser_locationbar_entry_callback, inUserData);
		}
}
Ejemplo n.º 18
0
/**
 * gel_ui_container_replace_children:
 * @container: A #GtkContainer
 * @widget: (transfer full): A #GtkWidget
 *
 * Removes all children from @container using gel_ui_container_clear() and
 * then packs @widget into @container
 */
void
gel_ui_container_replace_children(GtkContainer *container, GtkWidget *widget)
{
	g_return_if_fail(GTK_IS_CONTAINER(container));
	g_return_if_fail(GTK_IS_WIDGET(widget));

	gtk_container_foreach(container, (GtkCallback) gtk_widget_destroy, NULL);
	if (GTK_IS_BOX(container))
		gtk_box_pack_start(GTK_BOX(container), widget, TRUE, TRUE, 0);
	else if (GTK_IS_GRID(container))
	{
		gtk_grid_attach(GTK_GRID(container), widget, 0, 0, 1, 1);
		g_object_set((GObject *) widget, "hexpand", TRUE, "vexpand", TRUE, NULL);
	}
}
Ejemplo n.º 19
0
static void clear_search(dt_lib_location_t *lib)
{
  g_free(lib->response);
  lib->response = NULL;
  lib->response_size = 0;
  lib->selected_location = NULL;

  g_list_free_full(lib->places, (GDestroyNotify)free_location);
  lib->places = NULL;

  gtk_container_foreach(GTK_CONTAINER(lib->result), (GtkCallback)gtk_widget_destroy, NULL);
  g_list_free_full(lib->callback_params, free);
  lib->callback_params = NULL;

  _clear_markers(lib);
}
Ejemplo n.º 20
0
/* updates the legend */
static void
update_legend()
{
  GtkWidget *prot_table;

  /* first, check if there are expired protocols */
  prot_table = glade_xml_get_widget (appdata.xml, "prot_table");
  if (!prot_table)
    return;

  gtk_container_foreach(GTK_CONTAINER(prot_table), 
                        (GtkCallback)purge_expired_legend_protocol, NULL);

  /* then search for new protocols */
  check_new_protocol(prot_table, protocol_summary_stack());
}
Ejemplo n.º 21
0
void
ide_frame_set_placeholder (IdeFrame  *self,
                           GtkWidget *placeholder)
{
  IdeFramePrivate *priv = ide_frame_get_instance_private (self);

  g_return_if_fail (IDE_IS_FRAME (self));
  g_return_if_fail (!placeholder || GTK_IS_WIDGET (placeholder));

  gtk_container_foreach (GTK_CONTAINER (priv->empty_placeholder),
                         (GtkCallback) gtk_widget_destroy,
                         NULL);

  if (placeholder != NULL)
    gtk_container_add (GTK_CONTAINER (priv->empty_placeholder), placeholder);
}
Ejemplo n.º 22
0
static void
photos_import_dialog_collections_popover_search_changed (PhotosImportDialog *self)
{
  guint16 text_length;

  gtk_container_foreach (GTK_CONTAINER (self->collections_popover_grid), (GtkCallback) gtk_widget_destroy, NULL);

  text_length = gtk_entry_get_text_length (GTK_ENTRY (self->collections_popover_search_entry));
  if (text_length == 0)
    {
      GList *l;

      for (l = self->recent_collections; l != NULL; l = l->next)
        {
          GtkWidget *collection_button;
          PhotosBaseItem *collection = PHOTOS_BASE_ITEM (l->data);

          collection_button = photos_import_dialog_create_collection_button (collection);
          gtk_container_add (GTK_CONTAINER (self->collections_popover_grid), collection_button);
          gtk_widget_show_all (collection_button);
        }
    }
  else
    {
      g_autoptr (GArray) matches = NULL;
      const gchar *text;
      guint i;

      text = gtk_entry_get_text (GTK_ENTRY (self->collections_popover_search_entry));
      matches = dzl_fuzzy_mutable_index_match (self->index, text, MAX_MATCHES);

      for (i = 0; i < matches->len; i++)
        {
          const DzlFuzzyMutableIndexMatch *match;
          GtkWidget *collection_button;
          PhotosBaseItem *collection;

          match = &g_array_index (matches, DzlFuzzyMutableIndexMatch, i);
          collection = PHOTOS_BASE_ITEM (match->value);
          collection_button = photos_import_dialog_create_collection_button (collection);
          gtk_container_add (GTK_CONTAINER (self->collections_popover_grid), collection_button);
          gtk_widget_show_all (collection_button);
        }

      g_return_if_fail (matches->len <= MAX_MATCHES);
    }
}
Ejemplo n.º 23
0
/**
 * gedit_notebook_set_close_buttons_sensitive:
 * @nb: a #GeditNotebook
 * @sensitive: %TRUE to make the buttons sensitive
 *
 * Sets whether the close buttons in the tabs of @nb are sensitive.
 */
void
gedit_notebook_set_close_buttons_sensitive (GeditNotebook *nb,
					    gboolean       sensitive)
{
	g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));

	sensitive = (sensitive != FALSE);

	if (sensitive == nb->priv->close_buttons_sensitive)
		return;

	nb->priv->close_buttons_sensitive = sensitive;

	gtk_container_foreach (GTK_CONTAINER (nb),
			       (GtkCallback)set_close_buttons_sensitivity,
			       nb);
}
Ejemplo n.º 24
0
static void _lib_history_change_callback(gpointer instance, gpointer user_data)
{
  dt_lib_module_t *self = (dt_lib_module_t *)user_data;
  dt_lib_history_t *d = (dt_lib_history_t *)self->data;

  /* first destroy all buttons in list */
  gtk_container_foreach(GTK_CONTAINER(d->history_box), (GtkCallback)gtk_widget_destroy, 0);

  /* add default which always should be */
  int num = -1;
  gtk_box_pack_start(GTK_BOX(d->history_box),
                     _lib_history_create_button(self, num, _("original"), FALSE, darktable.develop->history_end == 0),
                     TRUE, TRUE, 0);
  num++;

  /* lock history mutex */
  dt_pthread_mutex_lock(&darktable.develop->history_mutex);

  /* iterate over history items and add them to list*/
  GList *history = g_list_first(darktable.develop->history);
  while(history)
  {
    dt_dev_history_item_t *hitem = (dt_dev_history_item_t *)(history->data);

    gchar *label;
    if(!hitem->multi_name[0] || strcmp(hitem->multi_name, "0") == 0)
      label = g_strdup_printf("%s", hitem->module->name());
    else
      label = g_strdup_printf("%s %s", hitem->module->name(), hitem->multi_name);

    gboolean selected = (num == darktable.develop->history_end - 1);
    GtkWidget *widget = _lib_history_create_button(self, num, label, hitem->enabled, selected);
    g_free(label);

    gtk_box_pack_start(GTK_BOX(d->history_box), widget, TRUE, TRUE, 0);
    gtk_box_reorder_child(GTK_BOX(d->history_box), widget, 0);
    num++;

    history = g_list_next(history);
  }

  /* show all widgets */
  gtk_widget_show_all(d->history_box);

  dt_pthread_mutex_unlock(&darktable.develop->history_mutex);
}
Ejemplo n.º 25
0
// If you should ever need to change the font for the running application..
// Ugly but effective.
void
change_font(GtkWidget *widget, gpointer data)
{
    PangoFontDescription *font_desc;
    gchar *font = (gchar*)data;
    const gchar *name;

    font_desc = pango_font_description_from_string(font);
    if (font_desc == NULL) exit(1);
    gtk_widget_modify_font(widget, font_desc);
    name = ghb_get_setting_key(widget);
    g_debug("changing font for widget %s\n", name);
    if (GTK_IS_CONTAINER(widget))
    {
        gtk_container_foreach((GtkContainer*)widget, change_font, data);
    }
}
Ejemplo n.º 26
0
/**
 * set toolbar logical -> physical; physically visible toolbar buttons are made
 * to correspond to the logically stored schema in terms of location
 * visibility etc
 */
void nsgtk_toolbar_set_physical(nsgtk_scaffolding *g)
{
	int i;
	struct nsgtk_theme *theme =
			nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR);
	if (theme == NULL) {
		warn_user(messages_get("NoMemory"), 0);
		return;
	}
	/* simplest is to clear the toolbar then reload it from memory */
	gtk_container_foreach(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
			nsgtk_toolbar_clear_toolbar, g);
	for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++)
		nsgtk_toolbar_add_item_to_toolbar(g, i, theme);
	gtk_widget_show_all(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)));
	free(theme);
}
Ejemplo n.º 27
0
/*	Remove a menu logically */
void EvalCcRqDELETEMENU (CrossCallInfo *pcci)			/* HMENU, HITEM; no result. */
{
    GtkWidget *menu, *menu_item;
    printf("EvalCcRqDELETEMENU\n");

    menu = GTK_WIDGET(pcci->p1);
    menu_item = GTK_WIDGET(pcci->p2);

    gtk_container_foreach(GTK_CONTAINER(menu), find_item_callback, (gpointer) &menu_item);
    if (menu_item != GTK_WIDGET(pcci->p2))
    {
        gtk_menu_item_remove_submenu(GTK_MENU_ITEM(menu_item));
        gtk_widget_destroy(menu_item);
    }

    MakeReturn0Cci (pcci);
}
Ejemplo n.º 28
0
void EvalCcRqMENUENABLE (CrossCallInfo *pcci)	/* parent, zero based position of menu, onoff; no result. */
{
    GtkWidget *parent_menu, *sub_menu;
    printf("EvalCcRqMENUENABLE\n");
    gint index = pcci->p2;

    if (pcci->p1 && GTK_IS_CONTAINER(pcci->p1))
    {
        printf("We have a container. Checking the widget.\n");
        parent_menu = GTK_WIDGET(pcci->p1);
        gtk_container_foreach(GTK_CONTAINER(parent_menu), pcci->p3 ?
                        enable_menu_callback : disable_menu_callback,
                        (gpointer) (&index));
    }

    MakeReturn0Cci (pcci);
}
Ejemplo n.º 29
0
void plugin_menu_remove (int id, MenuFunc func)
{
    if (menus[id])
        gtk_container_foreach ((GtkContainer *) menus[id], (GtkCallback)
         remove_cb, (void *) func);

    GList * next;
    for (GList * node = items[id]; node; node = next)
    {
        next = node->next;

        if (((struct Item *) node->data)->func == func)
        {
            g_slice_free (struct Item, node->data);
            items[id] = g_list_delete_link (items[id], node);
        }
    }
Ejemplo n.º 30
0
/**
 * ide_workbench_views_foreach:
 * @self: An #IdeWorkbench.
 * @callback: (scope call): The callback to execute
 * @user_data: user data for @callback.
 *
 * Executes @callback for every #IdeLayoutView across all perspectives.
 */
void
ide_workbench_views_foreach (IdeWorkbench *self,
                             GtkCallback   callback,
                             gpointer      user_data)
{
  struct {
    GtkCallback callback;
    gpointer    user_data;
  } closure = { callback, user_data };

  g_return_if_fail (IDE_IS_WORKBENCH (self));
  g_return_if_fail (callback != NULL);

  gtk_container_foreach (GTK_CONTAINER (self->perspectives_stack),
                         ide_workbench_views_foreach_cb,
                         &closure);
}