Exemplo n.º 1
0
/****************************************************************************
  Temporarily disable signal invocation of the given callback for the given
  GObject. Re-enable the signal with enable_gobject_callback.
****************************************************************************/
void disable_gobject_callback(GObject *obj, GCallback cb)
{
  gulong hid;

  if (!obj || !cb) {
    return;
  }

  hid = g_signal_handler_find(obj, G_SIGNAL_MATCH_FUNC,
                              0, 0, NULL, cb, NULL);
  g_signal_handler_block(obj, hid);
}
Exemplo n.º 2
0
static void add_button_clicked(GtkButton *button, XmiMsimGuiLayerDialog *dialog) {
  //make entries empty and disable OK button
  GtkWidget *compound_dialog = xmi_msim_gui_compound_dialog_new(GTK_WINDOW(dialog), XMI_MSIM_GUI_COMPOUND_DIALOG_TYPE_ADD);

  int rv = gtk_dialog_run(GTK_DIALOG(compound_dialog));

  if (rv == GTK_RESPONSE_ACCEPT) {
    //something was changed
    gchar *compound = xmi_msim_gui_compound_dialog_get_compound(XMI_MSIM_GUI_COMPOUND_DIALOG(compound_dialog));
    gdouble compound_weight = xmi_msim_gui_compound_dialog_get_weight(XMI_MSIM_GUI_COMPOUND_DIALOG(compound_dialog));

    struct compoundData *cd, *cd2, *cdsum;
    cd2 = CompoundParser(compound);

    //get current composition
    int n_elements, *Z;
    double *weight;
    xmi_msim_gui_layer_dialog_get_composition(dialog, &n_elements, &Z, &weight);
    if (n_elements > 0) {
      xmi_layer layer = {n_elements, Z, weight, 0.0, 0.0};

      //copy xmi_layer to compoundData and add current contents
      cd = xmi_layer2compoundData(&layer);
      //calculate sum
      cdsum = add_compound_data(*cd, 1.0, *cd2, compound_weight/100.0);
      xmi_msim_gui_layer_dialog_set_composition(dialog, cdsum->nElements, cdsum->Elements, cdsum->massFractions);
      g_free(Z);
      g_free(weight);
      FreeCompoundData(cdsum);
      FreeCompoundData(cd);
    }
    else {
      //list is empty!
      xmi_scale_double(cd2->massFractions, cd2->nElements, compound_weight/100.0);
      if (cd2->nElements == 1) {
        // if compound
        double density = ElementDensity(cd2->Elements[0]);
        gchar *buffer = g_strdup_printf("%f", density);
        g_signal_handler_block(G_OBJECT(dialog->densityEntry), dialog->density_changed);
        gtk_entry_set_text(GTK_ENTRY(dialog->densityEntry), buffer);
        g_signal_handler_unblock(G_OBJECT(dialog->densityEntry), dialog->density_changed);
	g_free(buffer);
      }
      xmi_msim_gui_layer_dialog_set_composition(dialog, cd2->nElements, cd2->Elements, cd2->massFractions);
    }
    FreeCompoundData(cd2);
  }

  gtk_widget_destroy(compound_dialog);

  return;
}
Exemplo n.º 3
0
gint keypress (GtkWidget *widget, GdkEventKey *key)
{
    int game_area;

    if (widget == app)
    {
      int cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
      int pfields_page = gtk_notebook_page_num(GTK_NOTEBOOK(notebook),
                                               pfields);
      /* Main window - check the notebook */
      game_area = (cur_page == pfields_page);
    }
    else
    {
        /* Sub-window - find out which */
        char *title = NULL;

        title = g_object_get_data(G_OBJECT(widget), "title");
        game_area =  title && !strcmp( title, _("Playing Fields"));
    }

    if (game_area)
    { /* keys for the playing field - key releases needed - install timeout */
      if (keytimeoutid && key->time == k.time)
        g_source_remove (keytimeoutid);
    }

    /* Check if it's a GTetrinet key */
    if (gtetrinet_key (key->keyval, key->state & (GDK_MOD1_MASK)))
    {
      g_signal_stop_emission_by_name (G_OBJECT(widget), "key-press-event");
      return TRUE;
    }

/*    if ((key->state & (GDK_MOD1_MASK | GDK_CONTROL_MASK)) > 0)
    return FALSE;*/
    
    if (game_area && ingame && (gdk_keyval_to_lower (key->keyval) == keys[K_GAMEMSG]))
    {
      g_signal_handler_block (app, keypress_signal);
      fields_gmsginputactivate (TRUE);
      g_signal_stop_emission_by_name (G_OBJECT(widget), "key-press-event");
    }

    if (game_area && tetrinet_key (key->keyval))
    {
      g_signal_stop_emission_by_name (G_OBJECT(widget), "key-press-event");
      return TRUE;
    }
    
    return FALSE;
}
Exemplo n.º 4
0
static void
on_selection_changed (GtkTreeSelection *treeselection,
		      gpointer user_data)
{
	NautilusBookmark *selected;
	char *name = NULL, *uri = NULL;
	
	g_assert (GTK_IS_ENTRY (name_field));
	g_assert (GTK_IS_ENTRY (uri_field));

	selected = get_selected_bookmark ();

	if (selected) {
		name = nautilus_bookmark_get_name (selected);
		uri = nautilus_bookmark_get_uri (selected);
	}
	
	/* Set the sensitivity of widgets that require a selection */
	gtk_widget_set_sensitive (remove_button, selected != NULL);
        gtk_widget_set_sensitive (jump_button, selected != NULL);
	gtk_widget_set_sensitive (name_field, selected != NULL);
	gtk_widget_set_sensitive (uri_field, selected != NULL);

	g_signal_handler_block (name_field, name_field_changed_signal_id);
	nautilus_entry_set_text (NAUTILUS_ENTRY (name_field),
				 name ? name : "");
	g_signal_handler_unblock (name_field, name_field_changed_signal_id);

	g_signal_handler_block (uri_field, uri_field_changed_signal_id);
	nautilus_entry_set_text (NAUTILUS_ENTRY (uri_field),
				 uri ? uri : "");
	g_signal_handler_unblock (uri_field, uri_field_changed_signal_id);

	text_changed = FALSE;
	name_text_changed = FALSE;

	g_free (name);
	g_free (uri);
}
Exemplo n.º 5
0
static void
toggle_state_changed (GActionGroup     *group,
                      const gchar      *name,
                      GVariant         *state,
                      GtkCheckMenuItem *w)
{
  ActionData *a;

  a = g_object_get_data (G_OBJECT (w), "action");
  g_signal_handler_block (w, a->activate_handler);
  gtk_check_menu_item_set_active (w, g_variant_get_boolean (state));
  g_signal_handler_unblock (w, a->activate_handler);
}
static void update(RyostklconfigProDimnessSelector *dimness_selector) {
	RyostklconfigProDimnessSelectorPrivate *priv = dimness_selector->priv;
	gchar *text;

	text = get_text_for_data(dimness_selector);

	g_signal_handler_block(G_OBJECT(dimness_selector), priv->changed_handler_id);
	set_text(dimness_selector, text);
	g_signal_handler_unblock(G_OBJECT(dimness_selector), priv->changed_handler_id);

	g_free(text);

}
Exemplo n.º 7
0
static void
time_adj_on_changed(GtkAdjustment *adj, gpointer user_data)
{
	GtkVlcPlayer *player = GTK_VLC_PLAYER(user_data);

	/* avoid signal handler recursion */
	g_signal_handler_block(G_OBJECT(adj),
			       player->priv->time_adj_on_changed_id);
	gtk_adjustment_set_upper(adj, (gdouble)gtk_vlc_player_get_length(player) +
				      gtk_adjustment_get_page_size(adj));
	g_signal_handler_unblock(G_OBJECT(adj),
				 player->priv->time_adj_on_changed_id);
}
Exemplo n.º 8
0
static void block_changed_signal(GObject *instance)
{
	GList *list;
	GList *cur;

	list = g_object_get_data(G_OBJECT(instance), "selection_list");
	for (cur = g_list_first(list); cur != NULL; cur = g_list_next(cur)) {
		GtkTreeSelection *selection = cur->data;
		gulong handler_id;
		handler_id = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(selection), "changed_handler_id"));
		g_signal_handler_block(G_OBJECT(selection), handler_id);
	}
}
Exemplo n.º 9
0
static void
prop_binding_block_cb (gpointer hkey,
                       PropBinding *binding,
                       const gchar *key)
{
	g_return_if_fail (binding != NULL);
	g_return_if_fail (key != NULL);

	if (binding->type == BINDING_PROP && binding->key &&
		g_ascii_strcasecmp (binding->key, key) == 0)
		g_signal_handler_block (
			binding->object, binding->prop_notify_id);
}
Exemplo n.º 10
0
int
clip_GTK_SIGNALHANDLERBLOCK(ClipMachine *cm)
{
	C_widget *cwid = _fetch_cw_arg(cm);
	int    conn_id = _clip_parni(cm,2);
	CHECKCWID(cwid,GTK_IS_OBJECT);
	CHECKARG(2,NUMERIC_t);
	//gtk_signal_handler_block(GTK_OBJECT(cwid->widget),conn_id);
	g_signal_handler_block(GTK_OBJECT(cwid->widget),conn_id);
	return 0;
err:
	return 1;
}
Exemplo n.º 11
0
static void
knot_moved_handler (SPKnot *knot, NRPointF *p, guint state, gpointer data)
{
	SPKnotHolder *knot_holder;
	SPItem *item;
	SPObject *object;
	NRMatrixF i2d;
	GSList *el;

	knot_holder = (SPKnotHolder *) data;
	item  = SP_ITEM (knot_holder->item);
	object = SP_OBJECT (item);

	for (el = knot_holder->entity; el; el = el->next) {
		SPKnotHolderEntity *e = (SPKnotHolderEntity *)el->data;
		if (e->knot == knot) {
			NRMatrixF d2i;
			NRPointF q;

			sp_item_i2d_affine(item, &i2d);
			nr_matrix_f_invert (&d2i, &i2d);
			q.x = NR_MATRIX_DF_TRANSFORM_X (&d2i, p->x, p->y);
			q.y = NR_MATRIX_DF_TRANSFORM_Y (&d2i, p->x, p->y);

			e->knot_set (item, &q, state);

			break;
		}
	}
	
	sp_shape_set_shape (SP_SHAPE (item));

	sp_item_i2d_affine(item, &i2d);

	for (el = knot_holder->entity; el; el = el->next) {
		SPKnotHolderEntity *e = (SPKnotHolderEntity *)el->data;
		NRPointF sp, dp;
		GObject *kob;
		
		kob = G_OBJECT (e->knot);

		e->knot_get (item, &sp);

		dp.x = NR_MATRIX_DF_TRANSFORM_X (&i2d, sp.x, sp.y);
		dp.y = NR_MATRIX_DF_TRANSFORM_Y (&i2d, sp.x, sp.y);

		g_signal_handler_block (kob, e->handler_id);
		sp_knot_set_position (e->knot, &dp, SP_KNOT_STATE_NORMAL);
		g_signal_handler_unblock (kob, e->handler_id);
	}
}
Exemplo n.º 12
0
static void
cb_plot_area_changed (GtkWidget *spin, PlotAreaPrefState *state)
{
	GogViewAllocation pos;
	double value;
	double max;

       	value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin)) / 100.0;

       	gog_chart_get_plot_area (state->chart, &pos);
	if (spin == state->x_spin) {
		pos.x = value;
		max = 1.0 - pos.x;
		g_signal_handler_block (state->w_spin, state->w_spin_signal);
		gtk_spin_button_set_range (GTK_SPIN_BUTTON (state->w_spin), 0.0, max * 100.0);
		if (pos.w > max) pos.w = max;
		gtk_spin_button_set_value (GTK_SPIN_BUTTON (state->w_spin), pos.w * 100.0);
		g_signal_handler_unblock (state->w_spin, state->w_spin_signal);
	}
	else if (spin == state->y_spin) {
		pos.y = value;
		max = 1.0 - pos.y;
		g_signal_handler_block (state->h_spin, state->h_spin_signal);
		gtk_spin_button_set_range (GTK_SPIN_BUTTON (state->h_spin), 0.0, max * 100.0);
		if (pos.h > max) pos.h = max;
		gtk_spin_button_set_value (GTK_SPIN_BUTTON (state->h_spin), pos.w * 100.0);
		g_signal_handler_unblock (state->h_spin, state->h_spin_signal);
	}
	else if (spin == state->w_spin) {
		pos.w = value;
	}
	else if (spin == state->h_spin) {
		pos.h = value;
	}
	gog_chart_set_plot_area (state->chart, &pos);
	gtk_combo_box_set_active (GTK_COMBO_BOX (state->position_select_combo), 1);
	gtk_widget_show (state->manual_setting_grid);
}
Exemplo n.º 13
0
static void
exit_activated_cb (TrayProvider *tray)
{
    GdkEventAny ev;
    
    menu_selection_done_cb (tray);
    
    ev.type = GDK_DELETE;
    ev.window = tray->window->window;
    ev.send_event = TRUE;

    g_signal_handler_block (tray->window, tray->sig);
    gtk_main_do_event ((GdkEvent *) &ev);
}
Exemplo n.º 14
0
bool wxSlider::Create(wxWindow *parent, wxWindowID id,
                      int value, int minValue, int maxValue,
                      const wxPoint& pos, const wxSize& size,
                      long style, const wxValidator& validator, const wxString& name )
{
    m_acceptsFocus = true;
    m_needParent = true;

    if (!PreCreation( parent, pos, size ) ||
            !CreateBase( parent, id, pos, size, style, validator, name ))
    {
        wxFAIL_MSG( wxT("wxSlider creation failed") );
        return false;
    }

    m_pos = 0;
    m_scrollEventType = 0;
    m_needThumbRelease = false;

    if (style & wxSL_VERTICAL)
        m_widget = gtk_vscale_new( (GtkAdjustment *) NULL );
    else
        m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );

    gtk_scale_set_draw_value(GTK_SCALE (m_widget), (style & wxSL_LABELS) != 0);
    // Keep full precision in position value
    gtk_scale_set_digits(GTK_SCALE (m_widget), -1);

    if (style & wxSL_INVERSE)
        gtk_range_set_inverted( GTK_RANGE(m_widget), TRUE );

    g_signal_connect(m_widget, "button_press_event", G_CALLBACK(gtk_button_press_event), this);
    g_signal_connect(m_widget, "button_release_event", G_CALLBACK(gtk_button_release_event), this);
    g_signal_connect(m_widget, "move_slider", G_CALLBACK(gtk_move_slider), this);
    g_signal_connect(m_widget, "format_value", G_CALLBACK(gtk_format_value), NULL);
    g_signal_connect(m_widget, "value_changed", G_CALLBACK(gtk_value_changed), this);
    gulong handler_id;
    handler_id = g_signal_connect(
                     m_widget, "event_after", G_CALLBACK(gtk_event_after), this);
    g_signal_handler_block(m_widget, handler_id);

    SetRange( minValue, maxValue );
    SetValue( value );

    m_parent->DoAddChild( this );

    PostCreation(size);

    return true;
}
Exemplo n.º 15
0
/* Only-second-level changed in check-box or manager */
static void _nojs_preferences_on_check_second_level_only_changed(NoJSPreferences *self,
																	gpointer *inUserData)
{
	NoJSPreferencesPrivate	*priv=self->priv;
	gboolean				state;

	/* Get toggle state of widget (but block signal for manager) and set in manager */
	g_signal_handler_block(priv->manager, priv->signalManagerChangedCheckSecondLevelID);

	state=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->checkSecondLevelOnlyCheckbox));
	nojs_set_only_second_level_domain(priv->manager, state);

	g_signal_handler_unblock(priv->manager, priv->signalManagerChangedCheckSecondLevelID);
}
Exemplo n.º 16
0
/* Allow-all-sites changed in check-box or manager */
static void _nojs_preferences_on_allow_all_sites_changed(NoJSPreferences *self,
																gpointer *inUserData)
{
	NoJSPreferencesPrivate	*priv=self->priv;
	gboolean				state;

	/* Get toggle state of widget (but block signal for manager) and set in manager */
	g_signal_handler_block(priv->manager, priv->signalManagerChangedAllowAllSitesID);

	state=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->allowAllSitesCheckbox));
	nojs_set_allow_all_sites(priv->manager, state);

	g_signal_handler_unblock(priv->manager, priv->signalManagerChangedAllowAllSitesID);
}
Exemplo n.º 17
0
void update_item_active(MITEM *mitems)
{
  int i;
  for(i=0; mitems[i].name; i++)
    if (mitems[i].check_dat) {
      GtkWidget *item = mitems[i].item;
      if (!item)
        continue;

      g_signal_handler_block(item, mitems[i].handler);
      gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), *mitems[i].check_dat);
      g_signal_handler_unblock(item, mitems[i].handler);
    }
}
Exemplo n.º 18
0
static void
notify_fontname (XpadPreferences *pref)
{
	const gchar *fontname = xpad_settings_get_fontname (xpad_settings ());
	
	g_signal_handler_block (pref->priv->fontbutton, pref->priv->font_handler);
	g_signal_handler_block (pref->priv->fontcheck, pref->priv->fontcheck_handler);
	
	if (fontname)
	{
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->fontcheck), TRUE);
		gtk_widget_set_sensitive (pref->priv->fontbutton, TRUE);
		gtk_font_button_set_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton), fontname);
	}
	else
	{
		gtk_widget_set_sensitive (pref->priv->fontbutton, FALSE);
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->antifontcheck), TRUE);
	}
	
	g_signal_handler_unblock (pref->priv->fontcheck, pref->priv->fontcheck_handler);
	g_signal_handler_unblock (pref->priv->fontbutton, pref->priv->font_handler);
}
Exemplo n.º 19
0
static void
change_font_check (GtkToggleButton *button, XpadPreferences *pref)
{
	g_signal_handler_block (xpad_settings (), pref->priv->notify_font_handler);
	
	if (!gtk_toggle_button_get_active (button))
		xpad_settings_set_fontname (xpad_settings (), NULL);
	else
		xpad_settings_set_fontname (xpad_settings (), gtk_font_button_get_font_name (GTK_FONT_BUTTON (pref->priv->fontbutton)));
	
	gtk_widget_set_sensitive (pref->priv->fontbutton, gtk_toggle_button_get_active (button));
	
	g_signal_handler_unblock (xpad_settings (), pref->priv->notify_font_handler);
}
Exemplo n.º 20
0
static void
notify_text_color (XpadPreferences *pref)
{
	const GdkColor *color = xpad_settings_get_text_color (xpad_settings ());
	
	g_signal_handler_block (pref->priv->textbutton, pref->priv->text_handler);
	g_signal_handler_block (pref->priv->colorcheck, pref->priv->colorcheck_handler);
	
	if (color)
	{
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->colorcheck), TRUE);
		gtk_widget_set_sensitive (pref->priv->colorbox, TRUE);
		gtk_color_button_set_color (GTK_COLOR_BUTTON (pref->priv->textbutton), color);
	}
	else
	{
		gtk_widget_set_sensitive (pref->priv->colorbox, FALSE);
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->anticolorcheck), TRUE);
	}
	
	g_signal_handler_unblock (pref->priv->colorcheck, pref->priv->colorcheck_handler);
	g_signal_handler_unblock (pref->priv->textbutton, pref->priv->text_handler);
}
Exemplo n.º 21
0
void lamixer_volbox_changed(GtkObject *adjustment, VolBox *volumebox)
{
	long rangevalue_left,rangevalue_right,increment;

	rangevalue_left = gtk_range_get_value(GTK_RANGE(adjustment));
	if (volumebox->type == 1) {
		snd_mixer_selem_set_playback_volume (volumebox->volelem, SND_MIXER_SCHN_FRONT_LEFT, rangevalue_left);
	}
	else if (volumebox->type == 2) {
		snd_mixer_selem_set_capture_volume (volumebox->volelem, SND_MIXER_SCHN_FRONT_LEFT, rangevalue_left);
	}

	if ((volumebox->lockswitch != NULL) && (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(volumebox->lockswitch)))) {

		if (volumebox->type == 1) {
			snd_mixer_selem_get_playback_volume (volumebox->volelem, SND_MIXER_SCHN_FRONT_RIGHT, &rangevalue_right);
		}
		else if (volumebox->type == 2) {
			snd_mixer_selem_get_capture_volume (volumebox->volelem, SND_MIXER_SCHN_FRONT_RIGHT, &rangevalue_right);
		}

		//TODO: Percent increment will be better?
		increment = rangevalue_left-volumebox->curval;

		if ( ((rangevalue_right<volumebox->maxrange) && (rangevalue_right>volumebox->minrange)) || \
		    ((rangevalue_right==volumebox->maxrange) && (increment<0)) || ((rangevalue_right==volumebox->minrange) && (increment>0)) ) {		

				if (((rangevalue_right+increment)<=(long)volumebox->maxrange) && ((rangevalue_right+increment)>=(long)volumebox->minrange)) {
					rangevalue_right = rangevalue_right+increment;
				}
				else {
					if ((rangevalue_right+increment) < ((long)volumebox->minrange))
						rangevalue_right = volumebox->minrange;
					else
						rangevalue_right = volumebox->maxrange;
				}
				g_signal_handler_block(G_OBJECT(volumebox->rvolbar), volumebox->hsignalidr);
				gtk_range_set_value(GTK_RANGE(volumebox->rvolbar), rangevalue_right);
				if (volumebox->type == 1) {
					snd_mixer_selem_set_playback_volume (volumebox->volelem, SND_MIXER_SCHN_FRONT_RIGHT, rangevalue_right);
				}
				else if (volumebox->type == 2) {
					snd_mixer_selem_set_capture_volume (volumebox->volelem, SND_MIXER_SCHN_FRONT_RIGHT, rangevalue_right);
				}
				volumebox->rcurval = rangevalue_right;
				g_signal_handler_unblock(G_OBJECT(volumebox->rvolbar), volumebox->hsignalidr);
			}
	}
	volumebox->curval = rangevalue_left;
}
Exemplo n.º 22
0
void update_icon(void){
	E_RETURN is_wall_active;
	is_wall_active = torwall_client_status();
	if (is_wall_active == STATUS_RUNNING) {
		gtk_status_icon_set_from_icon_name(tray_icon, "torwallActive");
		update_notify(TOOL_ACTIVE, "torwallActive");
		gtk_status_icon_set_tooltip(tray_icon, 
				TOOL_ACTIVE);
		g_signal_handler_block(ch_toggle, ch_toggle_handler_id);
		gtk_check_menu_item_set_active(ch_toggle, 1);
		gtk_widget_set_sensitive((GtkWidget*)i_currentnode, 1);
		g_signal_handler_unblock(ch_toggle, ch_toggle_handler_id);
	} else {
		gtk_status_icon_set_from_icon_name(tray_icon, "torwallInactive");
		update_notify(TOOL_INACTIVE, "torwallInactive");
		gtk_status_icon_set_tooltip(tray_icon, 
				TOOL_INACTIVE);
		g_signal_handler_block(ch_toggle, ch_toggle_handler_id);
		gtk_check_menu_item_set_active(ch_toggle, 0);
		gtk_widget_set_sensitive((GtkWidget*)i_currentnode, 0);
		g_signal_handler_unblock(ch_toggle, ch_toggle_handler_id);
	}
}
static void
on_row_deleted (GtkListStore *store,
		GtkTreePath *path,
		gpointer user_data)
{
	gint *indices, row;

	indices = gtk_tree_path_get_indices (path);
	row = indices[0];

	g_signal_handler_block (bookmarks, bookmark_list_changed_signal_id);
	nautilus_bookmark_list_delete_item_at (bookmarks, row);
	g_signal_handler_unblock (bookmarks, bookmark_list_changed_signal_id);
}
Exemplo n.º 24
0
/**
 * Handle toggle events on "Default" check box
 * @param cell The item that received the signal.
 * @param path_str Path string.
 * @param data Pointer to user data (list store).
 *
 * This function is called when the user clicks on "Default" check box
 * indicating that a new default location has been selected. If the
 * clicked check box has been un-checked the action is ignored, because
 * we need a default location. If the clicked check box has been checked,
 * the default flag of the checked QTH is set to TRUE, while the flag is
 * cleared for all the other QTH's.
 */
static void default_toggled(GtkCellRendererToggle * cell, gchar * path_str,
                            gpointer data)
{
    GtkTreeModel   *model = (GtkTreeModel *) data;
    GtkTreeIter     iter;
    GtkTreePath    *path = gtk_tree_path_new_from_string(path_str);
    gboolean        fixed;
    gchar          *defqth;

    /* block toggle signals while we mess with the check boxes */
    g_signal_handler_block(cell, handler_id);

    /* get toggled iter */
    gtk_tree_model_get_iter(model, &iter, path);
    gtk_tree_model_get(model, &iter, QTH_LIST_COL_DEF, &fixed, -1);

    if (fixed)
    {
        /* do nothing except sending a message */
        sat_log_log(SAT_LOG_LEVEL_INFO,
                    _("%s:%d: Default QTH can not be cleared! "
                      "Select another QTH to change default."),
                    __FILE__, __LINE__);
    }
    else
    {
        /* make this qth new default */
        gtk_list_store_set(GTK_LIST_STORE(model), &iter,
                           QTH_LIST_COL_DEF, TRUE, -1);

        /* copy file name of new default QTH to a string buffer */
        gtk_tree_model_get(model, &iter, QTH_LIST_COL_NAME, &defqth, -1);

        sat_log_log(SAT_LOG_LEVEL_INFO,
                    _("%s:%d: New default QTH is %s.qth."),
                    __FILE__, __LINE__, defqth);

        /* clear the default flag for the other qth */
        gtk_tree_model_foreach(model, clear_default_flags, defqth);

        g_free(defqth);

    }

    /* clean up */
    gtk_tree_path_free(path);

    /* unblock toggle signals */
    g_signal_handler_unblock(cell, handler_id);
}
Exemplo n.º 25
0
static void
on_selection_changed (GtkTreeSelection *treeselection,
		      gpointer user_data)
{
	NautilusBookmarksWindow *self = user_data;
	NautilusBookmark *selected;
	const char *name = NULL;
	char *entry_text = NULL;
	GFile *location;

	selected = get_selected_bookmark (self);

	if (selected) {
		name = nautilus_bookmark_get_name (selected);
		location = nautilus_bookmark_get_location (selected);
		entry_text = g_file_get_parse_name (location);

		g_object_unref (location);
	}

	update_widgets_sensitivity (self);

	g_signal_handler_block (self->priv->name_field, self->priv->name_changed_id);
	nautilus_entry_set_text (NAUTILUS_ENTRY (self->priv->name_field),
				 name ? name : "");
	g_signal_handler_unblock (self->priv->name_field, self->priv->name_changed_id);

	g_signal_handler_block (self->priv->uri_field, self->priv->uri_changed_id);
	nautilus_entry_set_text (NAUTILUS_ENTRY (self->priv->uri_field),
				 entry_text ? entry_text : "");
	g_signal_handler_unblock (self->priv->uri_field, self->priv->uri_changed_id);

	self->priv->text_changed = FALSE;
	self->priv->name_text_changed = FALSE;

	g_free (entry_text);
}
Exemplo n.º 26
0
static void
on_row_deleted (GtkListStore *store,
		GtkTreePath *path,
		gpointer user_data)
{
	NautilusBookmarksWindow *self = user_data;
	gint *indices, row;

	indices = gtk_tree_path_get_indices (path);
	row = indices[0];

	g_signal_handler_block (self->priv->bookmarks, self->priv->bookmarks_changed_id);
	nautilus_bookmark_list_delete_item_at (self->priv->bookmarks, row);
	g_signal_handler_unblock (self->priv->bookmarks, self->priv->bookmarks_changed_id);
}
Exemplo n.º 27
0
void gglk_text_auto_scroll(GglkText *tb)
{
    if(!tb->should_scroll)
	return;
    tb->should_scroll = FALSE;

    if(tb->vadjust)
	g_signal_handler_block(tb->vadjust, tb->scroll_handler);

    gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tb),
				 tb->scrollmark, 0.1,
				 TRUE, 0.0, 0.0);
    if(tb->vadjust)
	g_signal_handler_unblock(tb->vadjust, tb->scroll_handler);
}
Exemplo n.º 28
0
static void
calendar_update_details (CalendarData *data)
{
  guint year, month, day;
  gchar *detail;

  gtk_calendar_get_date (GTK_CALENDAR (data->calendar_widget), &year, &month, &day);
  detail = calendar_get_detail (data, year, month, day);

  g_signal_handler_block (data->details_buffer, data->details_changed);
  gtk_text_buffer_set_text (data->details_buffer, detail ? detail : "", -1);
  g_signal_handler_unblock (data->details_buffer, data->details_changed);

  g_free (detail);
}
Exemplo n.º 29
0
void radio_button_set_active_no_signal( GtkRadioButton* radio, int index ){
	{
		for ( GSList* l = gtk_radio_button_get_group( radio ); l != 0; l = g_slist_next( l ) )
		{
			g_signal_handler_block( G_OBJECT( l->data ), gpointer_to_int( g_object_get_data( G_OBJECT( l->data ), "handler" ) ) );
		}
	}
	radio_button_set_active( radio, index );
	{
		for ( GSList* l = gtk_radio_button_get_group( radio ); l != 0; l = g_slist_next( l ) )
		{
			g_signal_handler_unblock( G_OBJECT( l->data ), gpointer_to_int( g_object_get_data( G_OBJECT( l->data ), "handler" ) ) );
		}
	}
}
Exemplo n.º 30
0
static void
radio_state_changed (GActionGroup     *group,
                     const gchar      *name,
                     GVariant         *state,
                     GtkCheckMenuItem *w)
{
  ActionData *a;
  gboolean b;

  a = g_object_get_data (G_OBJECT (w), "action");
  g_signal_handler_block (w, a->activate_handler);
  b = g_strcmp0 (a->target, g_variant_get_string (state, NULL)) == 0;
  gtk_check_menu_item_set_active (w, b);
  g_signal_handler_unblock (w, a->activate_handler);
}