Example #1
0
static void
gimp_config_connect_full_notify (GObject    *src,
                                 GParamSpec *param_spec,
                                 GObject    *dest)
{
  if (param_spec->flags & G_PARAM_READABLE)
    {
      gchar      *attach_key;
      gchar      *dest_prop_name;
      GParamSpec *dest_spec = NULL;

      attach_key = g_strdup_printf ("%p-%s", dest, param_spec->name);
      dest_prop_name = g_object_get_data (src, attach_key);
      g_free (attach_key);

      if (dest_prop_name)
        dest_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (dest),
                                                  dest_prop_name);

      if (dest_spec                                         &&
          (dest_spec->value_type == param_spec->value_type) &&
          (dest_spec->flags & G_PARAM_WRITABLE)             &&
          (dest_spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0)
        {
          GValue value = { 0, };

          g_value_init (&value, param_spec->value_type);

          g_object_get_property (src,  param_spec->name, &value);

          g_signal_handlers_block_by_func (dest,
                                           gimp_config_connect_full_notify, src);
          g_object_set_property (dest, dest_prop_name, &value);
          g_signal_handlers_unblock_by_func (dest,
                                             gimp_config_connect_full_notify, src);

          g_value_unset (&value);
        }
    }
}
static void
infinoted_plugin_linekeeper_join_user(
  InfinotedPluginLinekeeperSessionInfo* info)
{
  InfSession* session;
  InfUserTable* user_table;

  g_assert(info->user == NULL);
  g_assert(info->request == NULL);

  g_object_get(G_OBJECT(info->proxy), "session", &session, NULL);
  user_table = inf_session_get_user_table(session);

  /* Prevent double user join attempt by blocking the callback for
   * joining our local user. */
  g_signal_handlers_block_by_func(
    user_table,
    G_CALLBACK(infinoted_plugin_linekeeper_add_available_user_cb),
    info
  );

  info->request = inf_text_session_join_user(
    info->proxy,
    "LineKeeper",
    INF_USER_ACTIVE,
    0.0,
    inf_text_buffer_get_length(info->buffer),
    0,
    infinoted_plugin_linekeeper_user_join_cb,
    info
  );

  g_signal_handlers_unblock_by_func(
    user_table,
    G_CALLBACK(infinoted_plugin_linekeeper_add_available_user_cb),
    info
  );

  g_object_unref(session);
}
static void
screen_position_notify_cb (GSettings *settings,
                           const gchar *key,
                           ZoomOptions *options)
{
  ZoomOptionsPrivate *priv = options->priv;
  gchar *position;
  GtkTreeIter iter;
  GtkTreeModel *model;
  GtkComboBox *combobox;
  gboolean valid;
  gchar *combo_value;

  position = g_settings_get_string (settings, key);
  position = g_settings_get_string (priv->settings, key);
  combobox = GTK_COMBO_BOX (WID ("screen_position_combo_box"));
  model = gtk_combo_box_get_model (combobox);

  /* Find the matching screen position value in the combobox model.  If nothing
   * matches, leave the combobox as is.
   */
  valid = gtk_tree_model_get_iter_first (model, &iter);
  while (valid)
    {
        gtk_tree_model_get (model, &iter,
                            POSITION_MODEL_VALUE_COLUMN, &combo_value,
                            -1);
        if (!g_strcmp0 (combo_value, position))
          {
            g_signal_handlers_block_by_func (combobox, screen_position_combo_changed_cb, priv);
            gtk_combo_box_set_active_iter (combobox, &iter);
            g_signal_handlers_unblock_by_func (combobox, screen_position_combo_changed_cb, priv);
            g_free (combo_value);
            break;
          }

        g_free (combo_value);
        valid = gtk_tree_model_iter_next (model, &iter);
    }
}
Example #4
0
static void
cell_renderer_toggle_toggled_cb (GtkCellRendererToggle *cell_renderer,
				 char                  *path,
                                 gpointer               user_data)
{
	DialogData  *data = user_data;
	GtkTreePath *tpath;
	GtkTreeIter  iter;
	gboolean     visible;

	tpath = gtk_tree_path_new_from_string (path);
	if (tpath == NULL)
		return;

	if (gtk_tree_model_get_iter (GTK_TREE_MODEL (data->list_store), &iter, tpath)) {
		GthScript     *script;
		GthScriptFile *script_file;

		gtk_tree_model_get (GTK_TREE_MODEL (data->list_store), &iter,
				    COLUMN_SCRIPT, &script,
				    COLUMN_VISIBLE, &visible,
				    -1);
		visible = ! visible;
		g_object_set (script, "visible", visible, NULL);

		script_file = gth_script_file_get ();
		g_signal_handlers_block_by_func (script_file, scripts_changed_cb, data);
		gth_script_file_add (script_file, script);
		gth_script_file_save (script_file, NULL);
		g_signal_handlers_unblock_by_func (script_file, scripts_changed_cb, data);

		gtk_list_store_set (data->list_store, &iter,
				    COLUMN_VISIBLE, visible,
				    -1);

		g_object_unref (script);
	}

	gtk_tree_path_free (tpath);
}
static void
ip_address_filter_cb (GtkEntry *   entry,
                      const gchar *text,
                      gint         length,
                      gint *       position,
                      gpointer     user_data)
{
	GtkWidget *ok_button = user_data;
	GtkEditable *editable = GTK_EDITABLE (entry);
	int i, count = 0;
	gchar *result;

	result = g_malloc0 (length + 1);

	for (i = 0; i < length; i++) {
		if (g_ascii_isxdigit(text[i]) || (text[i] == ':'))
			result[count++] = text[i];
	}

	if (count > 0) {
		g_signal_handlers_block_by_func (G_OBJECT (editable),
		                                 G_CALLBACK (ip_address_filter_cb),
		                                 user_data);
		gtk_editable_insert_text (editable, result, count, position);
		g_free (last_edited);
		last_edited = g_strdup (gtk_editable_get_chars (editable, 0, -1));
		g_signal_handlers_unblock_by_func (G_OBJECT (editable),
		                                   G_CALLBACK (ip_address_filter_cb),
		                                   user_data);
	}

	g_signal_stop_emission_by_name (G_OBJECT (editable), "insert-text");
	g_free (result);

	/* Desensitize the OK button during input to simplify input validation.
	 * All routes will be validated on focus-out, which will then re-enable
	 * the OK button if the routes are valid.
	 */
	gtk_widget_set_sensitive (ok_button, FALSE);
}
Example #6
0
static void bar_pane_keywords_keyword_toggle(GtkCellRendererToggle *toggle, const gchar *path, gpointer data)
{
	PaneKeywordsData *pkd = data;
	GtkTreeModel *model;
	GtkTreeIter iter;
	GtkTreePath *tpath;
	gboolean active;
	GList *list;
	GtkTreeIter child_iter;
	GtkTreeModel *keyword_tree;

	GtkTextBuffer *keyword_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(pkd->keyword_view));

	model = gtk_tree_view_get_model(GTK_TREE_VIEW(pkd->keyword_treeview));

	tpath = gtk_tree_path_new_from_string(path);
	gtk_tree_model_get_iter(model, &iter, tpath);
	gtk_tree_path_free(tpath);

	gtk_tree_model_get(model, &iter, FILTER_KEYWORD_COLUMN_TOGGLE, &active, -1);
	active = (!active);


	keyword_tree = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(model));
	gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(model), &child_iter, &iter);

	list = keyword_list_pull(pkd->keyword_view);
	if (active)
		keyword_tree_set(keyword_tree, &child_iter, &list);
	else
		keyword_tree_reset(keyword_tree, &child_iter, &list);

	g_signal_handlers_block_by_func(keyword_buffer, bar_pane_keywords_changed, pkd);
	keyword_list_push(pkd->keyword_view, list);
	string_list_free(list);
	g_signal_handlers_unblock_by_func(keyword_buffer, bar_pane_keywords_changed, pkd);

	/* call this just once in the end */
	bar_pane_keywords_changed(keyword_buffer, pkd);
}
Example #7
0
void
xmr_player_set_volume(XmrPlayer *player,
			float		 volume)
{
	g_return_if_fail( player != NULL);
	g_return_if_fail (volume >= 0.0 && volume <= 1.0);

	if (player->priv->playbin == NULL)
		return ;

	g_signal_handlers_block_by_func(player->priv->playbin, volume_notify_cb, player);

	if (gst_element_implements_interface(player->priv->playbin, GST_TYPE_STREAM_VOLUME))
		gst_stream_volume_set_volume(GST_STREAM_VOLUME(player->priv->playbin),
					      GST_STREAM_VOLUME_FORMAT_CUBIC, volume);
	else
		g_object_set(player->priv->playbin, "volume", volume, NULL);

	g_signal_handlers_unblock_by_func(player->priv->playbin, volume_notify_cb, player);

	player->priv->cur_volume = volume;
}
Example #8
0
static void
gimp_scale_entry_log_adjustment_callback (GtkAdjustment *adjustment,
                                          GtkAdjustment *other_adj)
{
  gdouble value;

  g_signal_handlers_block_by_func (other_adj,
                                   gimp_scale_entry_exp_adjustment_callback,
                                   adjustment);

  if (gtk_adjustment_get_lower (adjustment) <= 0.0)
    value = log (gtk_adjustment_get_value (adjustment) -
                 gtk_adjustment_get_lower (adjustment) + 0.1);
  else
    value = log (gtk_adjustment_get_value (adjustment));

  gtk_adjustment_set_value (other_adj, value);

  g_signal_handlers_unblock_by_func (other_adj,
                                     gimp_scale_entry_exp_adjustment_callback,
                                     adjustment);
}
Example #9
0
static void bar_pane_comment_update(PaneCommentData *pcd)
{
	gchar *comment = NULL;
	gchar *orig_comment = NULL;
	gchar *comment_not_null;
	GtkTextBuffer *comment_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(pcd->comment_view));

	orig_comment = text_widget_text_pull(pcd->comment_view);
	comment = metadata_read_string(pcd->fd, pcd->key, METADATA_PLAIN);
	comment_not_null = (comment) ? comment : "";

	if (strcmp(orig_comment, comment_not_null) != 0)
		{
		g_signal_handlers_block_by_func(comment_buffer, bar_pane_comment_changed, pcd);
		gtk_text_buffer_set_text(comment_buffer, comment_not_null, -1);
		g_signal_handlers_unblock_by_func(comment_buffer, bar_pane_comment_changed, pcd);
		}
	g_free(comment);
	g_free(orig_comment);

	gtk_widget_set_sensitive(pcd->comment_view, (pcd->fd != NULL));
}
Example #10
0
static void
set_language_from_metadata (GeditSpellChecker *spell,
			    GeditDocument     *doc)
{
	const GeditSpellCheckerLanguage *lang = NULL;
	gchar *value = NULL;

	value = gedit_document_get_metadata (doc, GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE);

	if (value != NULL)
	{
		lang = gedit_spell_checker_language_from_key (value);
		g_free (value);
	}

	if (lang != NULL)
	{
		g_signal_handlers_block_by_func (spell, set_spell_language_cb, doc);
		gedit_spell_checker_set_language (spell, lang);
		g_signal_handlers_unblock_by_func (spell, set_spell_language_cb, doc);
	}
}
Example #11
0
static void
selection_changed_cb (GdauiDataSelector *sel, UiFormGrid *formgrid)
{
	GdaDataModelIter *iter;
	GdauiDataSelector *tosel;
	gint row;
	if (sel == (GdauiDataSelector*) formgrid->priv->raw_grid)
		tosel = (GdauiDataSelector*) formgrid->priv->raw_form;
	else
		tosel = (GdauiDataSelector*) formgrid->priv->raw_grid;

	iter = gdaui_data_selector_get_data_set (sel);
	g_assert (iter);
	row = gda_data_model_iter_get_row (iter);
	/*g_print ("Moved %s to row %d\n", sel == (GdauiDataSelector*) formgrid->priv->raw_grid ? "grid" : "form", row);*/
	iter = gdaui_data_selector_get_data_set (tosel);
	if (iter) {
		g_signal_handlers_block_by_func (tosel, G_CALLBACK (selection_changed_cb), formgrid);
		gda_data_model_iter_move_to_row (iter, row >= 0 ? row : 0);
		g_signal_handlers_unblock_by_func (tosel, G_CALLBACK (selection_changed_cb), formgrid);
	}
}
static void
contact_widget_avatar_notify_cb (EmpathyContactWidget *information)
{
  EmpathyAvatar *avatar = NULL;

  if (information->contact)
      avatar = empathy_contact_get_avatar (information->contact);

  if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_AVATAR)
    {
      g_signal_handlers_block_by_func (information->widget_avatar,
          contact_widget_avatar_changed_cb,
          information);
      empathy_avatar_chooser_set (
          EMPATHY_AVATAR_CHOOSER (information->widget_avatar), avatar);
      g_signal_handlers_unblock_by_func (information->widget_avatar,
          contact_widget_avatar_changed_cb, information);
    }
  else
      empathy_avatar_image_set (
          EMPATHY_AVATAR_IMAGE (information->widget_avatar), avatar);
}
Example #13
0
static void
on_update_widget_view_menuitem (gpointer key, gpointer wid, gpointer data)
{
	GtkCheckMenuItem *menuitem;
	GdlDockItem *dockitem;

	dockitem = g_object_get_data (G_OBJECT (wid), "dockitem");
	menuitem = g_object_get_data (G_OBJECT (wid), "menuitem");

	g_signal_handlers_block_by_func (menuitem,
									 G_CALLBACK (on_toggle_widget_view),
									 dockitem);

	if (GDL_DOCK_OBJECT_ATTACHED (dockitem))
		gtk_check_menu_item_set_active (menuitem, TRUE);
	else
		gtk_check_menu_item_set_active (menuitem, FALSE);

	g_signal_handlers_unblock_by_func (menuitem,
									   G_CALLBACK (on_toggle_widget_view),
									   dockitem);
}
Example #14
0
static void
gimp_text_style_editor_set_kerning (GimpTextStyleEditor *editor,
                                    GtkTextTag          *kerning_tag)
{
  gint kerning = 0;

  if (kerning_tag)
    kerning = gimp_text_tag_get_kerning (kerning_tag);

  g_signal_handlers_block_by_func (editor->kerning_adjustment,
                                   gimp_text_style_editor_kerning_changed,
                                   editor);

  gtk_adjustment_set_value (editor->kerning_adjustment,
                            (gdouble) kerning / PANGO_SCALE);
  /* make sure the "" really gets replaced */
  gtk_adjustment_value_changed (editor->kerning_adjustment);

  g_signal_handlers_unblock_by_func (editor->kerning_adjustment,
                                     gimp_text_style_editor_kerning_changed,
                                     editor);
}
Example #15
0
static void
update_volume_from_playbin (GthMediaViewerPage *self)
{
	double volume;

	if ((self->priv->builder == NULL) || (self->priv->playbin == NULL))
		return;

	g_object_get (self->priv->playbin, "volume", &volume, NULL);
	if (volume == 0.0)
		gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET ("togglebutton_volume_image")), "audio-volume-muted", GTK_ICON_SIZE_BUTTON);
	else if (volume < 3.3)
		gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET ("togglebutton_volume_image")), "audio-volume-low", GTK_ICON_SIZE_BUTTON);
	else if (volume < 6.6)
		gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET ("togglebutton_volume_image")), "audio-volume-medium", GTK_ICON_SIZE_BUTTON);
	else
		gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET ("togglebutton_volume_image")), "audio-volume-high", GTK_ICON_SIZE_BUTTON);

	g_signal_handlers_block_by_func(GET_WIDGET ("adjustment_volume"), volume_value_changed_cb, self);
	gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("adjustment_volume")), volume * 10.0);
	g_signal_handlers_unblock_by_func(GET_WIDGET ("adjustment_volume"), volume_value_changed_cb, self);
}
Example #16
0
static void
gimp_text_style_editor_set_color (GimpTextStyleEditor *editor,
                                  GtkTextTag          *color_tag)
{
  GimpRGB color;

  gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);

  if (color_tag)
    gimp_text_tag_get_color (color_tag, &color);

  g_signal_handlers_block_by_func (editor->color_button,
                                   gimp_text_style_editor_color_changed,
                                   editor);

  gimp_color_button_set_color (GIMP_COLOR_BUTTON (editor->color_button),
                               &color);

  g_signal_handlers_unblock_by_func (editor->color_button,
                                     gimp_text_style_editor_color_changed,
                                     editor);
}
Example #17
0
static void
gimp_text_style_editor_set_baseline (GimpTextStyleEditor *editor,
                                     GtkTextTag          *baseline_tag)
{
  gint baseline = 0;

  if (baseline_tag)
    baseline = gimp_text_tag_get_baseline (baseline_tag);

  g_signal_handlers_block_by_func (editor->baseline_adjustment,
                                   gimp_text_style_editor_baseline_changed,
                                   editor);

  gtk_adjustment_set_value (editor->baseline_adjustment,
                            (gdouble) baseline / PANGO_SCALE);
  /* make sure the "" really gets replaced */
  gtk_adjustment_value_changed (editor->baseline_adjustment);

  g_signal_handlers_unblock_by_func (editor->baseline_adjustment,
                                     gimp_text_style_editor_baseline_changed,
                                     editor);
}
Example #18
0
static void
set_auto_spell_from_metadata (GeditWindow    *window,
			      GeditDocument  *doc,
			      GtkActionGroup *action_group)
{
	gboolean active = FALSE;
	gchar *active_str;
	GeditDocument *active_doc;

	active_str = gedit_document_get_metadata (doc,
						  GEDIT_METADATA_ATTRIBUTE_SPELL_ENABLED);

	if (active_str)
	{
		active = *active_str == '1';
	
		g_free (active_str);
	}

	set_auto_spell (window, doc, active);

	/* In case that the doc is the active one we mark the spell action */
	active_doc = gedit_window_get_active_document (window);

	if (active_doc == doc && action_group != NULL)
	{
		GtkAction *action;
		
		action = gtk_action_group_get_action (action_group,
						      "AutoSpell");

		g_signal_handlers_block_by_func (action, auto_spell_cb,
						 window);
		gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
					      active);
		g_signal_handlers_unblock_by_func (action, auto_spell_cb,
						   window);
	}
}
static void show_desktop_changed(WnckScreen *screen)
{
        ShowDesktop *sd;

        sd = (ShowDesktop *) g_object_get_data(G_OBJECT(screen), "sd");
        
        g_signal_handlers_block_by_func(G_OBJECT(screen),
                                        G_CALLBACK(show_desktop_changed),
                                        NULL);
       
        sd->lock = TRUE;
        
        sd->is_showing_desktop = wnck_screen_get_showing_desktop(screen);
        update_button_state(sd, sd->is_showing_desktop);
        update_tooltip(sd);
        
        sd->lock = FALSE;
        
        g_signal_handlers_unblock_by_func(G_OBJECT(screen),
                                          G_CALLBACK(show_desktop_changed),
                                          NULL);
}
Example #20
0
G_MODULE_EXPORT void 
gw_settingswindow_sync_spellcheck_cb (GSettings *settings, gchar *KEY, gpointer data)
{
    //Declarations
    GwSettingsWindow *window;
    GwSettingsWindowPrivate *priv;
    GtkWidget *toplevel;
    GtkToggleButton *togglebutton;
    gboolean request;

    //Initializations
    window = GW_SETTINGSWINDOW (data);
    g_return_if_fail (window != NULL);
    priv = window->priv;
    toplevel = gw_window_get_toplevel (GW_WINDOW (window));
    togglebutton = GTK_TOGGLE_BUTTON (priv->spellcheck_checkbutton);
    request = lw_preferences_get_boolean (settings, KEY);

    G_GNUC_EXTENSION g_signal_handlers_block_by_func (togglebutton, gw_settingswindow_spellcheck_toggled_cb, toplevel);
    gtk_toggle_button_set_active (togglebutton, request);
    G_GNUC_EXTENSION g_signal_handlers_unblock_by_func (togglebutton, gw_settingswindow_spellcheck_toggled_cb, toplevel);
}
Example #21
0
static void
gimp_dynamics_editor_notify_model (GimpDynamics       *options,
                                   const GParamSpec   *pspec,
                                   GimpDynamicsEditor *editor)
{
  GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);

  if (data_editor->data)
    {
      g_signal_handlers_block_by_func (data_editor->data,
                                       gimp_dynamics_editor_notify_data,
                                       editor);

      gimp_config_copy (GIMP_CONFIG (editor->dynamics_model),
                        GIMP_CONFIG (data_editor->data),
                        GIMP_CONFIG_PARAM_SERIALIZE);

      g_signal_handlers_unblock_by_func (data_editor->data,
                                         gimp_dynamics_editor_notify_data,
                                         editor);
    }
}
Example #22
0
static void
update_current_position_bar (GthMediaViewerPage *self,
			     gboolean            update_progressbar)
{
	GstFormat format;
        gint64    current_value = 0;

        format = GST_FORMAT_TIME;
        if (gst_element_query_position (self->priv->playbin, &format, &current_value)) {
        	char *s;

        	if (self->priv->duration <= 0) {
        		gst_element_query_duration (self->priv->playbin, &format, &self->priv->duration);
        		s = _g_format_duration_for_display (GST_TIME_AS_MSECONDS (self->priv->duration));
        		gtk_label_set_text (GTK_LABEL (GET_WIDGET ("label_duration")), s);

        		g_free (s);
        	}

        	/*
        	g_print ("==> %" G_GINT64_FORMAT " / %" G_GINT64_FORMAT " (%0.3g)\n" ,
        		 current_value,
        		 self->priv->duration,
        		 ((double) current_value / self->priv->duration) * 100.0);
		*/

        	if (update_progressbar) {
			g_signal_handlers_block_by_func(GET_WIDGET ("adjustment_position"), position_value_changed_cb, self);
			gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("adjustment_position")), (self->priv->duration > 0) ? ((double) current_value / self->priv->duration) * 100.0 : 0.0);
			g_signal_handlers_unblock_by_func(GET_WIDGET ("adjustment_position"), position_value_changed_cb, self);
        	}

        	s = _g_format_duration_for_display (GST_TIME_AS_MSECONDS (current_value));
        	gtk_label_set_text (GTK_LABEL (GET_WIDGET ("label_position")), s);

        	g_free (s);
        }
}
Example #23
0
static void
gimp_navigation_editor_shell_scaled (GimpDisplayShell     *shell,
                                     GimpNavigationEditor *editor)
{
  if (editor->zoom_label)
    {
      gchar *str;

      g_object_get (shell->zoom,
                    "percentage", &str,
                    NULL);
      gtk_label_set_text (GTK_LABEL (editor->zoom_label), str);
      g_free (str);
    }

  if (editor->zoom_adjustment)
    {
      gdouble val;

      val = log (gimp_zoom_model_get_factor (shell->zoom)) / G_LN2;

      g_signal_handlers_block_by_func (editor->zoom_adjustment,
                                       gimp_navigation_editor_zoom_adj_changed,
                                       editor);

      gtk_adjustment_set_value (editor->zoom_adjustment, val);

      g_signal_handlers_unblock_by_func (editor->zoom_adjustment,
                                         gimp_navigation_editor_zoom_adj_changed,
                                         editor);
    }

  gimp_navigation_editor_update_marker (editor);

  if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
    gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
                            gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
}
Example #24
0
// TODO: decide what to do with the button when not in explicit star mode.
//       - insensitive makes a bright button and is ugly
//       - changing the string makes the width change slightly
//       - leaving it clickable is probably confusing as it doesn't do anything then
static gboolean _lib_filter_sync_combobox_and_comparator(dt_lib_module_t *self)
{
  dt_lib_tool_filter_t *d = (dt_lib_tool_filter_t *)self->data;
  int filter = gtk_combo_box_get_active(GTK_COMBO_BOX(d->filter));
  //   dt_collection_rating_comperator_t comparator =
  //   dt_collection_get_rating_comparator(darktable.collection);

  // 0 all
  // 1 unstarred only
  // 2 ★
  // 3 ★ ★
  // 4 ★ ★ ★
  // 5 ★ ★ ★ ★
  // 6 ★ ★ ★ ★ ★
  // 7 rejected only
  // 8 all except rejected

  g_signal_handlers_block_by_func(d->comparator, _lib_filter_compare_button_changed, self);

  if(filter > 1 && filter < 7)
  {
    // stars -> enable d->comparator and set its text to comparators[comparator]
    //     gtk_widget_set_sensitive(d->comparator, TRUE);
    //     gtk_button_set_label(GTK_BUTTON(d->comparator), comparators[comparator]);
    gtk_widget_show(d->comparator);
  }
  else
  {
    // disable d->comparator and set its text to something funny or stupid or just different
    //     gtk_widget_set_sensitive(d->comparator, FALSE);
    //     gtk_button_set_label(GTK_BUTTON(d->comparator), " ");
    gtk_widget_hide(d->comparator);
  }

  g_signal_handlers_unblock_by_func(d->comparator, _lib_filter_compare_button_changed, self);

  return FALSE;
}
Example #25
0
static void
anjuta_docman_order_tabs (AnjutaDocman *docman)
{
	gint i, num_pages;
	GList *node;
	AnjutaDocmanPage *page;
	order_struct *tab_labels;
	GtkNotebook *notebook;

	notebook = GTK_NOTEBOOK (docman);

	num_pages = gtk_notebook_get_n_pages (notebook);
	if (num_pages < 2)
		return;
	tab_labels = g_new0 (order_struct, num_pages);
	node = docman->priv->pages;
	for (i = 0; i < num_pages; i++)
	{
		if (node != NULL && node->data != NULL)
		{
			page = node->data;
			tab_labels[i].m_widget = page->widget; /* CHECKME needed ? */
			tab_labels[i].m_label = ianjuta_document_get_filename (page->doc, NULL);
			node = g_list_next (node);
		}
	}
	qsort (tab_labels, num_pages, sizeof(order_struct), do_ordertab1);
	g_signal_handlers_block_by_func (G_OBJECT (notebook),
									(gpointer) on_notebook_page_reordered,
									(gpointer) docman);
	for (i = 0; i < num_pages; i++)
		gtk_notebook_reorder_child (notebook, tab_labels[i].m_widget, i);
	g_signal_handlers_unblock_by_func (G_OBJECT (notebook),
									  (gpointer) on_notebook_page_reordered,
									  (gpointer) docman);
	g_free (tab_labels);
	anjuta_docman_update_documents_menu(docman);
}
Example #26
0
static void
color_scheme_combo_changed_cb (GtkWidget *combo,
                               GParamSpec *pspec,
                               TerminalProfile *profile)
{
	guint i;

	i = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));

	if (i < G_N_ELEMENTS (color_schemes))
	{
		g_signal_handlers_block_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
		g_object_set (profile,
		              TERMINAL_PROFILE_FOREGROUND_COLOR, &color_schemes[i].foreground,
		              TERMINAL_PROFILE_BACKGROUND_COLOR, &color_schemes[i].background,
		              NULL);
		g_signal_handlers_unblock_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
	}
	else
	{
		/* "custom" selected, no change */
	}
}
Example #27
0
static void
gimp_color_button_selection_changed (GtkWidget       *selection,
                                     GimpColorButton *button)
{
  if (button->continuous_update)
    {
      GimpRGB color;

      gimp_color_selection_get_color (GIMP_COLOR_SELECTION (selection), &color);

      g_signal_handlers_block_by_func (button->color_area,
                                       gimp_color_button_area_changed,
                                       button);

      gimp_color_area_set_color (GIMP_COLOR_AREA (button->color_area), &color);

      g_signal_handlers_unblock_by_func (button->color_area,
                                         gimp_color_button_area_changed,
                                         button);

      g_signal_emit (button, gimp_color_button_signals[COLOR_CHANGED], 0);
    }
}
static void
show_hidden_files_preference_callback (gpointer callback_data)
{
	NautilusWindow *window;
	GtkAction *action;

	window = NAUTILUS_WINDOW (callback_data);

	if (window->details->show_hidden_files_mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
		action = gtk_action_group_get_action (window->details->main_action_group, NAUTILUS_ACTION_SHOW_HIDDEN_FILES);
		g_assert (GTK_IS_ACTION (action));

		/* update button */
		g_signal_handlers_block_by_func (action, action_show_hidden_files_callback, window);
		gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
					      eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES));
		g_signal_handlers_unblock_by_func (action, action_show_hidden_files_callback, window);

		/* inform views */
		nautilus_window_info_set_hidden_files_mode (window, NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT);

	}
}
Example #29
0
static void
on_book_cleared (CallHistoryViewGtk* data)
{
  GtkListStore *store = NULL;
  GtkTreeSelection *selection = NULL;

  g_return_if_fail (IS_CALL_HISTORY_VIEW_GTK (data));
  CallHistoryViewGtk *self = CALL_HISTORY_VIEW_GTK (data);

  store = GTK_LIST_STORE (gtk_tree_view_get_model (self->priv->tree));
  selection = gtk_tree_view_get_selection (self->priv->tree);

  /* Reset old data. This also ensures GIO actions are
   * properly removed before adding new ones.
   */
  self->priv->contact_menu.reset ();

  if (selection)
    g_signal_handlers_block_by_func (selection, (gpointer) on_selection_changed, self);
  gtk_list_store_clear (store);
  if (selection)
    g_signal_handlers_unblock_by_func (selection, (gpointer) on_selection_changed, self);
}
Example #30
0
static void
widget_composite_changed (GladeWidget      *widget,
			  GParamSpec       *pspec,
			  GladeEditorTable *table)
{
  if (!gtk_widget_get_mapped (GTK_WIDGET (table)))
    return;

  if (table->priv->name_label)
    gtk_label_set_text (GTK_LABEL (table->priv->name_label),
			glade_widget_get_is_composite (table->priv->loaded_widget) ?
			_("Class Name:") : _("ID:"));

  if (table->priv->composite_check)
    {
      g_signal_handlers_block_by_func (G_OBJECT (table->priv->composite_check),
				       G_CALLBACK (widget_composite_toggled), table);
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (table->priv->composite_check),
				    glade_widget_get_is_composite (table->priv->loaded_widget));
      g_signal_handlers_unblock_by_func (G_OBJECT (table->priv->composite_check),
					 G_CALLBACK (widget_composite_toggled), table);
    }
}