void TCPUnixAccountHandler::loadProperties()
{
	UT_DEBUGMSG(("TCPUnixAccountHandler::loadProperties()\n"));

	bool serve = getProperty("server") == "";

	if (server_button && GTK_IS_TOGGLE_BUTTON(server_button))
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(server_button), serve);

	if (client_button && GTK_IS_TOGGLE_BUTTON(client_button))
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(client_button), !serve);

	if (server_entry && GTK_IS_ENTRY(server_entry))
		gtk_entry_set_text(GTK_ENTRY(server_entry), getProperty("server").c_str());

	int port = DEFAULT_TCP_PORT;
	try {
		if (hasProperty("port"))
			port = boost::lexical_cast<int>(getProperty("port"));
	} catch (boost::bad_lexical_cast &) {
		UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
	}
	if (port_button && GTK_IS_ENTRY(port_button))
		gtk_spin_button_set_value(GTK_SPIN_BUTTON(port_button), port);

	if (allow_all_button && GTK_IS_TOGGLE_BUTTON(allow_all_button))
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(allow_all_button), hasProperty("allow-all") ? getProperty("allow-all") == "true" : false);

	bool autoconnect = hasProperty("autoconnect") ? getProperty("autoconnect") == "true" : true;
	if (autoconnect_button && GTK_IS_TOGGLE_BUTTON(autoconnect_button))
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autoconnect_button), autoconnect);
}
static void
update_application_details (BastileWidget *swidget)
{
	MateKeyringAccessControl *ac;
	GtkLabel *label;
	GtkToggleButton *toggle;
	MateKeyringAccessType access;
	GtkTreeView *tree;
	GtkTreePath *path;
	GtkTreeModel *model;
	GtkTreeSelection *selection;
	GtkTreeIter iter;
	gchar *filename;
    
	tree = GTK_TREE_VIEW (bastile_widget_get_widget (swidget, "application-list"));
	g_return_if_fail (GTK_IS_TREE_VIEW (tree));
	    
	selection = gtk_tree_view_get_selection (tree);
	if (!gtk_tree_selection_get_selected (selection, &model, &iter))
		return;
	        
	path = gtk_tree_model_get_path (model, &iter);
	g_return_if_fail (path);
	
	/* Dig out the current value */
	gtk_tree_model_get (model, &iter, APPS_ACCESS, &ac, -1);
	
	bastile_widget_set_sensitive (swidget, "application-details", ac != NULL);
    
	label = GTK_LABEL (bastile_widget_get_widget (swidget, "application-path"));
	g_return_if_fail (GTK_IS_LABEL (label));
	filename = ac ? mate_keyring_item_ac_get_path_name (ac) : NULL;
	gtk_label_set_text (label, filename ? filename : "");
	g_free (filename);

	g_object_set_data (G_OBJECT (swidget), "updating", "updating");
	access = ac ? mate_keyring_item_ac_get_access_type (ac) : 0;
    
	toggle = GTK_TOGGLE_BUTTON (bastile_widget_get_widget (swidget, "application-read"));
	g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle));
	gtk_toggle_button_set_active (toggle, access & MATE_KEYRING_ACCESS_READ);    

	toggle = GTK_TOGGLE_BUTTON (bastile_widget_get_widget (swidget, "application-write"));
	g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle));    
	gtk_toggle_button_set_active (toggle, access & MATE_KEYRING_ACCESS_WRITE);    

	toggle = GTK_TOGGLE_BUTTON (bastile_widget_get_widget (swidget, "application-delete"));
	g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle));
	gtk_toggle_button_set_active (toggle, access & MATE_KEYRING_ACCESS_REMOVE);
    
	g_object_set_data (G_OBJECT (swidget), "updating", NULL);
	mate_keyring_access_control_free (ac);
}
Пример #3
0
void run_with_choice_callb(GtkWidget *wdg, gpointer render_struct_ptr) {
//	Render a povray image after choosing a scene file
	gchar *path_n_file, *dir;
	if (wdg)
		if (GTK_IS_TOGGLE_BUTTON(wdg))
			if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wdg)))
				return;

	
	dir = (gchar *) get_current_dir_name();
	chdir(POV_DIR);

	path_n_file =
		GetFilename(	scene_ext_list,
				NB_SCENE_EXT,
				_("Open"),
				POV_DIR,
				EXISTING_FILE,
				scene_ext_list[0].lbl);
	if (path_n_file)
		SCENE = path_n_file;
	else
		return;
	POV_DIR = get_dir_name(path_n_file,FILESEP);
	// It could be dangerous to free SCENE before reinitializing it
	// It could contain a default #define value (check this... small memory leakage here).
	// However path_n_file is always "malloced" in GetFilename
	run_callb(wdg, render_struct_ptr);

	chdir(dir);
}
Пример #4
0
void ColorToolItem::enableColor(int color) {
	XOJ_CHECK_TYPE(ColorToolItem);

	if (isSelector()) {
		selectcolor_set_color(this->iconWidget, color);
		this->color = color;
		if (GTK_IS_TOGGLE_BUTTON(this->item)) {
			gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(this->item), false);
		}
	} else {
		bool active = colorEqualsMoreOreLess(color);

		if (this->item) {
			gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(this->item), active);
		}

		if (active) {
			this->toolHandler->setColorFound();

			// Only equals more ore less, so we will set it exact to the default color
			if (this->color != color) {
				this->toolHandler->setColor(this->color);
			}

		}
	}
}
void
test_toggle_button (gconstpointer data)
{
    GtkWidget *button, *dependent_widget;
    gboolean widget_value;
    gboolean xinput_value;
    const gchar *widget_name;
    const gchar *xinput_name;
    const gchar *dependent_widget_name;

    widget_name = gcut_data_get_string(data, "widget-name");
    xinput_name = gcut_data_get_string(data, "xinput-name");
    dependent_widget_name = gcut_data_get_string(data, "dependent-widget-name");

    button = get_widget(widget_name);
    cut_assert_true(GTK_IS_TOGGLE_BUTTON(button));

    xinput_value = get_boolean_property_of_xinput(xinput_name);
    widget_value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
    cut_assert_equal_int(xinput_value, widget_value);

    /* check widget sensitivity */
    dependent_widget = get_widget(dependent_widget_name);
    cut_assert_equal_int(widget_value, GTK_WIDGET_SENSITIVE(dependent_widget));

    gtk_test_widget_click(button, 1, 0);
    wait_action();
    xinput_value = get_boolean_property_of_xinput(xinput_name);
    cut_assert_equal_int(xinput_value, !widget_value);

    cut_assert_equal_int(!widget_value, GTK_WIDGET_SENSITIVE(dependent_widget));
}
Пример #6
0
static void getGtkComboBoxButton(GtkWidget* widget, gpointer target)
{
    if (!GTK_IS_TOGGLE_BUTTON(widget))
        return;
    GtkWidget** widgetTarget = static_cast<GtkWidget**>(target);
    *widgetTarget = widget;
}
Пример #7
0
bool
GtkAReViWidget::getWidgetString(const StlString &propName,StlString &propValueOut)
{
  GtkWidget *widget=glade_xml_get_widget(_xmlObject,propName.c_str());
  if (!widget)
  {
    cerr << "[getPropertyString] property '" << propName << "' no exist" << endl;
    return false;
  }

  if (GTK_IS_ENTRY(widget))
    propValueOut=/*strFromUTF8*/(gtk_entry_get_text(GTK_ENTRY(widget)));
  else if (GTK_IS_TOGGLE_BUTTON(widget))
  {
    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) propValueOut="true";
    else propValueOut="false";
  }
  else if (GTK_IS_TEXT_VIEW(widget))
  {
    GtkTextBuffer* buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
    GtkTextIter start, end;
    gtk_text_buffer_get_bounds(buffer,&start,&end);
    propValueOut=/*strFromUTF8*/(gtk_text_buffer_get_text(buffer,&start,&end,true));
  }
  else return false;

  return true;
}
Пример #8
0
static void update_dict_button()
{
	GList *children;
	GtkBoxChild *child;
	
	LOG(LOG_DEBUG, "IN : update_dict_button()");

	gtk_widget_hide(dict_box);

	// Re-creaet buttons

	children = GTK_BOX(dict_box)->children;
	while(children){
		child = children->data;
		children = children->next;
		if(GTK_IS_TOGGLE_BUTTON(child->widget))
			gtk_widget_destroy(child->widget);
	}

	add_dict_buttons(dict_box);
	gtk_widget_show_all(dict_box);

	LOG(LOG_DEBUG, "OUT : update_dict_button()");

}
Пример #9
0
static void make_widget_update_signal_based(struct iio_widget *widgets,
	unsigned int num_widgets)
{
	char signal_name[25];
	unsigned int i;

	for (i = 0; i < num_widgets; i++) {
		if (GTK_IS_CHECK_BUTTON(widgets[i].widget))
			sprintf(signal_name, "%s", "toggled");
		else if (GTK_IS_TOGGLE_BUTTON(widgets[i].widget))
			sprintf(signal_name, "%s", "toggled");
		else if (GTK_IS_SPIN_BUTTON(widgets[i].widget))
			sprintf(signal_name, "%s", "value-changed");
		else if (GTK_IS_COMBO_BOX_TEXT(widgets[i].widget))
			sprintf(signal_name, "%s", "changed");
		else
			printf("unhandled widget type, attribute: %s\n", widgets[i].attr_name);

		if (GTK_IS_SPIN_BUTTON(widgets[i].widget) &&
			widgets[i].priv_progress != NULL) {
				iio_spin_button_progress_activate(&widgets[i]);
		} else {
			g_signal_connect(G_OBJECT(widgets[i].widget), signal_name, G_CALLBACK(save_widget_value), &widgets[i]);
		}
	}
}
Пример #10
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;
}
Пример #11
0
gboolean
tour1d_varsel (GtkWidget *w, gint jvar, gint toggle, gint mouse, GGobiStage *d, GGobiSession *gg)
{
  displayd *dsp = gg->current_display;
  gboolean redraw = true;

  if (GTK_IS_TOGGLE_BUTTON(w) || GTK_IS_BUTTON(w)) {  /* toggle or 'label' */
    /*
     * add/remove jvar to/from the subset of variables that <may> be active
    */
    gboolean fade = gg->tour1d.fade_vars;

    redraw = tour1d_subset_var_set (jvar, d, dsp, gg);
    if (redraw) {
      varcircles_visibility_set (dsp, gg);

      /*-- Add/remove the variable to/from the active set, too.
           But: if we just removed it from the subset, but it was
           already inactive, there's no need to do anything --*/
      if (dsp->t1d.subset_vars_p.els[jvar] == false &&
          dsp->t1d.active_vars_p.els[jvar] == false)
        ;
      else {
        gg->tour1d.fade_vars = false;
        tour1d_active_var_set (jvar, d, dsp, gg);
        gg->tour1d.fade_vars = fade;

        if (dsp->t1d_window != NULL && GTK_WIDGET_VISIBLE (dsp->t1d_window)) {
          free_optimize0_p(&dsp->t1d_pp_op);
          alloc_optimize0_p(&dsp->t1d_pp_op, d->n_rows,
            dsp->t1d.nactive, 1);
          t1d_pp_reinit(dsp, gg);
        }
      }
    }

  } else if (GTK_IS_DRAWING_AREA(w)) {

    /*-- any button --*/
    if (d->vcirc_ui.jcursor == GDK_HAND2) { /* This part sets the manip var */
      tour1d_manip_var_set (jvar, mouse, gg);
      varcircles_cursor_set_default (d);
    } else { /* This part sets active/not active var */
      tour1d_active_var_set (jvar, d, dsp, gg);

      if (dsp->t1d_window != NULL && GTK_WIDGET_VISIBLE (dsp->t1d_window)) {
        free_optimize0_p(&dsp->t1d_pp_op);
        alloc_optimize0_p(&dsp->t1d_pp_op, d->n_rows, dsp->t1d.nactive, 
          1);
        t1d_pp_reinit(dsp, gg);
      }
    }
  }

  return redraw;
}
void TelepathyAccountHandler::storeProperties()
{
	UT_DEBUGMSG(("TelepathyAccountHandler::storeProperties()\n"));

	if (conference_entry && GTK_IS_ENTRY(conference_entry))
		addProperty("conference_server", gtk_entry_get_text(GTK_ENTRY(conference_entry)));

	if (autoconnect_button && GTK_IS_TOGGLE_BUTTON(autoconnect_button))
		addProperty("autoconnect", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(autoconnect_button)) ? "true" : "false" );
}
Пример #13
0
void
gimp_toggle_button_set_visible (GtkToggleButton *toggle,
                                GtkWidget       *widget)
{
  g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle));
  g_return_if_fail (GTK_IS_WIDGET (widget));

  gtk_widget_set_visible (widget,
                          gtk_toggle_button_get_active (toggle));
}
Пример #14
0
static void
thunar_apr_desktop_page_toggled (GtkWidget            *button,
                                 ThunarAprDesktopPage *desktop_page)
{
    g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
    g_return_if_fail (THUNAR_APR_IS_DESKTOP_PAGE (desktop_page));

    /* save the file */
    thunar_apr_desktop_page_save (desktop_page, button);
}
Пример #15
0
static void 
time_out_display_hours_toggled (GtkToggleButton *toggle_button,
                                TimeOutPlugin   *time_out)
{
  g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
  g_return_if_fail (time_out != NULL);

  /* Set display hours attribute */
  time_out->display_hours = gtk_toggle_button_get_active (toggle_button);
}
Пример #16
0
static void
time_out_auto_resume_toggled (GtkToggleButton *toggle_button,
                              TimeOutPlugin   *time_out)
{
  g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
  g_return_if_fail (time_out != NULL);

  /* Set resume attribute */
  time_out->auto_resume = gtk_toggle_button_get_active (toggle_button);
}
void TCPUnixAccountHandler::storeProperties()
{
	UT_DEBUGMSG(("TCPUnixAccountHandler::storeProperties()\n"));
	
	bool serve = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(server_button));
	if (server_entry && GTK_IS_ENTRY(server_entry))
	{
		// simply clear the server field if we are are hosting this session
		addProperty("server", serve ? "" : gtk_entry_get_text(GTK_ENTRY(server_entry)));
	}
	
	if (port_button && GTK_IS_ENTRY(port_button))
		addProperty("port", gtk_entry_get_text(GTK_ENTRY(port_button)));
		
	if (allow_all_button && GTK_IS_TOGGLE_BUTTON(allow_all_button))
		addProperty("allow-all", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(allow_all_button)) ? "true" : "false" );

	if (autoconnect_button && GTK_IS_TOGGLE_BUTTON(autoconnect_button))
		addProperty("autoconnect", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(autoconnect_button)) ? "true" : "false" );
}
Пример #18
0
/* We need to have pointers to the inner widgets (button, separator, arrow)
 * of the ComboBox to get the correct rendering from theme engines which
 * special cases their look. Since the inner layout can change, we ask GTK
 * to NULL our pointers when they are about to become invalid because the
 * corresponding widgets don't exist anymore. It's the role of
 * g_object_add_weak_pointer().
 * Note that if we don't find the inner widgets (which shouldn't happen), we
 * fallback to use generic "non-inner" widgets, and they don't need that kind
 * of weak pointer since they are explicit children of gParts->protoWindow and as
 * such GTK holds a strong reference to them. */
static void
moz_gtk_get_combo_box_inner_button(GtkWidget *widget, gpointer client_data)
{
    if (GTK_IS_TOGGLE_BUTTON(widget)) {
        gParts->comboBoxButtonWidget = widget;
        g_object_add_weak_pointer(G_OBJECT(widget),
                                  (gpointer) &gParts->comboBoxButtonWidget);
        gtk_widget_realize(widget);
        g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
    }
}
Пример #19
0
/** The "show zero totals" button in the Filter dialog changed state.
 *  Update the page to reflect these changes.
 *
 *  @param button The GtkCheckButton that was toggled.
 *
 *  @param fd A pointer to the owner filter dialog struct. */
void
gppot_filter_show_zero_toggled_cb (GtkToggleButton *button,
                                   OwnerFilterDialog *fd)
{
    g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button));

    ENTER("button %p", button);
    fd->show_zero_total = gtk_toggle_button_get_active(button);
    gnc_tree_view_owner_refilter(fd->tree_view);
    LEAVE("show_zero %d", fd->show_zero_total);
}
Пример #20
0
static void
set_arrow_state (GOComboBox *combo_box, gboolean state)
{
	GOComboBoxPrivate *priv = combo_box->priv;
	g_return_if_fail (!combo_box->priv->updating_buttons);

	combo_box->priv->updating_buttons = TRUE;
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->arrow_button), state);
	if (GTK_IS_TOGGLE_BUTTON (priv->display_widget))
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->display_widget), state);
	combo_box->priv->updating_buttons = FALSE;
}
void TelepathyAccountHandler::loadProperties()
{
	UT_DEBUGMSG(("TelepathyAccountHandler::loadProperties()\n"));

	std::string conference_server = getProperty("conference_server");
	if (conference_entry && GTK_IS_ENTRY(conference_entry))
		gtk_entry_set_text(GTK_ENTRY(conference_entry), conference_server.c_str());

	bool autoconnect = hasProperty("autoconnect") ? getProperty("autoconnect") == "true" : true;
	if (autoconnect_button && GTK_IS_TOGGLE_BUTTON(autoconnect_button))
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autoconnect_button), autoconnect);
}
Пример #22
0
/** get the widget int value */
int XAP_UnixWidget::getValueInt(void)
{
	if (GTK_IS_TOGGLE_BUTTON(m_widget)) {
		return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widget));
	}
	else if (GTK_IS_ENTRY(m_widget)) {
		return atoi(gtk_entry_get_text(GTK_ENTRY(m_widget)));
	}
	else {
		UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
	}
	return 0;
}
static void 
merge_toggle_button_access (BastileWidget *swidget, const gchar *identifier, 
                            MateKeyringAccessType *access, MateKeyringAccessType type)
{
	GtkToggleButton *toggle;
    
	toggle = GTK_TOGGLE_BUTTON (bastile_widget_get_widget (swidget, identifier));
	g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle));
	if (gtk_toggle_button_get_active (toggle))
		*access |= type;
	else
		*access &= ~type;
}
void SIPSimpleUnixAccountHandler::storeProperties()
{
	if (address_entry && GTK_IS_ENTRY(address_entry))
		addProperty("address", gtk_entry_get_text(GTK_ENTRY(address_entry)));

	if (password_entry && GTK_IS_ENTRY(password_entry))
		addProperty("password", gtk_entry_get_text(GTK_ENTRY(password_entry)));

	if (proxy_entry && GTK_IS_ENTRY(proxy_entry))
		addProperty("outbound-proxy", gtk_entry_get_text(GTK_ENTRY(proxy_entry)));

	if (autoconnect_button && GTK_IS_TOGGLE_BUTTON(autoconnect_button))
		addProperty("autoconnect", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(autoconnect_button)) ? "true" : "false" );
}
Пример #25
0
void fConnectCB(::GtkWidget* pWidget, gpointer data)
{
	if(GTK_IS_RANGE(pWidget))
	{
		g_signal_connect(G_OBJECT(pWidget), "value-changed", G_CALLBACK(fScrollCB), (gpointer) g_iAnalogCount);
		g_iAnalogCount++;
	}

	if(GTK_IS_TOGGLE_BUTTON(pWidget))
	{
		g_signal_connect(G_OBJECT(pWidget), "toggled", G_CALLBACK(fSwitchCB), (void*)g_iButtonCount);
		g_iButtonCount++;
	}
}
Пример #26
0
static void toggle_icon(GtkToggleButton *button, MimeView *mimeview)
{
	GList *child;
	
	child = gtk_container_children(GTK_CONTAINER(mimeview->icon_vbox));
	for (; child != NULL; child = g_list_next(child)) {
		if (GTK_IS_TOGGLE_BUTTON(child->data) && 
		    GTK_TOGGLE_BUTTON(child->data) != button &&
		    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(child->data)))
			gtk_toggle_button_set_active
				(GTK_TOGGLE_BUTTON(child->data),
				 FALSE);
	}
}
Пример #27
0
void stop_callb(GtkWidget *wdg, gpointer render_struct_ptr) {
	render_struct *rs = (render_struct *) render_struct_ptr;
	if (!rs)
		return;
	if (!wdg)
		return;
	if (GTK_IS_TOGGLE_BUTTON(wdg))
		if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wdg)))
			return;
	if (rs->povray_pid<=0)
		return;
	kill((pid_t) rs->povray_pid, SIGKILL);
	rs->povray_pid = 0;
}
Пример #28
0
static void ui_update_pal_checkbox (GtkWidget *w, gpointer data)
{
    app_shell_type *appshell = ((app_shell_type*) data);

    if (!w || !GTK_IS_TOGGLE_BUTTON(w)) {
        return;
    }

    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
        gtk_widget_show(appshell->pal_ctrl);
    } else {
        gtk_widget_hide(appshell->pal_ctrl);
    }

}
static void
account_widget_setup_widget (GtkWidget   *widget,
			     McAccount   *account,
			     const gchar *param_name)
{
	g_object_set_data_full (G_OBJECT (widget), "param_name",
				g_strdup (param_name), g_free);
	g_object_set_data_full (G_OBJECT (widget), "account",
				g_object_ref (account), g_object_unref);

	if (GTK_IS_SPIN_BUTTON (widget)) {
		gint value = 0;

		mc_account_get_param_int (account, param_name, &value);
		gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);

		g_signal_connect (widget, "value-changed",
				  G_CALLBACK (account_widget_int_changed_cb),
				  account);
	}
	else if (GTK_IS_ENTRY (widget)) {
		gchar *str = NULL;

		mc_account_get_param_string (account, param_name, &str);
		gtk_entry_set_text (GTK_ENTRY (widget), str ? str : "");
		g_free (str);

		if (strstr (param_name, "password")) {
			gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
		}

		g_signal_connect (widget, "focus-out-event",
				  G_CALLBACK (account_widget_entry_focus_cb),
				  account);
	}
	else if (GTK_IS_TOGGLE_BUTTON (widget)) {
		gboolean value = FALSE;

		mc_account_get_param_boolean (account, param_name, &value);
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);

		g_signal_connect (widget, "toggled",
				  G_CALLBACK (account_widget_checkbutton_toggled_cb),
				  account);
	} else {
		DEBUG ("Unknown type of widget for param %s", param_name);
	}
}
Пример #30
0
static void icon_list_toggle_by_mime_info(MimeView	*mimeview,
					  MimeInfo	*mimeinfo)
{
	GList *child;
	
	child = gtk_container_children(GTK_CONTAINER(mimeview->icon_vbox));
	for (; child != NULL; child = g_list_next(child)) {
		if (GTK_IS_TOGGLE_BUTTON(child->data) &&  
		    gtk_object_get_data(GTK_OBJECT(child->data),
					"partinfo") == (gpointer)mimeinfo) {
			toggle_icon(GTK_TOGGLE_BUTTON(child->data), mimeview);
			gtk_toggle_button_set_active
				(GTK_TOGGLE_BUTTON(child->data), TRUE);
		}				 
	}
}