您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GTK_SWITCH函数代码示例

51自学网 2021-06-01 20:59:01
  C++
这篇教程C++ GTK_SWITCH函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GTK_SWITCH函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_SWITCH函数的具体用法?C++ GTK_SWITCH怎么用?C++ GTK_SWITCH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GTK_SWITCH函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: gtk_switch_get_property

static voidgtk_switch_get_property (GObject    *gobject,                         guint       prop_id,                         GValue     *value,                         GParamSpec *pspec){  GtkSwitchPrivate *priv = GTK_SWITCH (gobject)->priv;  switch (prop_id)    {    case PROP_ACTIVE:      g_value_set_boolean (value, priv->is_active);      break;    case PROP_RELATED_ACTION:      g_value_set_object (value, priv->action);      break;    case PROP_USE_ACTION_APPEARANCE:      g_value_set_boolean (value, priv->use_action_appearance);      break;    default:      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);    }}
开发者ID:BYC,项目名称:gtk,代码行数:26,


示例2: gpinstruct_lesson_test_multi_choice_editor_new

GPInstructLessonTestMultiChoiceEditor *gpinstruct_lesson_test_multi_choice_editor_new (GPInstructEditorWindow *window,                                                GPInstructLessonTestMultiChoice *test){	GPInstructLessonTestMultiChoiceEditor *editor = g_object_new (GPINSTRUCT_TYPE_LESSON_TEST_MULTI_CHOICE_EDITOR, NULL);	GPInstructLessonTestMultiChoiceEditorPrivate *priv = editor->priv;	priv->window = window;	priv->test = test;	gtk_entry_set_text (GTK_ENTRY (priv->title_entry),	                    gpinstruct_lesson_element_get_title (GPINSTRUCT_LESSON_ELEMENT (test)));	g_signal_connect (priv->title_entry, "activate",	                  G_CALLBACK (title_entry_activate), editor);	GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->directions_view));	gtk_text_buffer_set_text (buffer,	                          gpinstruct_lesson_test_get_directions (GPINSTRUCT_LESSON_TEST (test)), -1);	g_signal_connect (buffer, "changed",	                  G_CALLBACK (directions_buffer_changed), editor);	gtk_switch_set_active (GTK_SWITCH (priv->explain_switch),	                       gpinstruct_lesson_test_get_explain (GPINSTRUCT_LESSON_TEST (test)));	g_signal_connect (priv->explain_switch, "notify::active",	                  G_CALLBACK (explain_activate), editor);	update_questions_tree_view (editor);	return editor;}
开发者ID:kyoushuu,项目名称:gpinstruct,代码行数:30,


示例3: gtk_switch_set_property

static voidgtk_switch_set_property (GObject      *gobject,                         guint         prop_id,                         const GValue *value,                         GParamSpec   *pspec){  GtkSwitch *sw = GTK_SWITCH (gobject);  switch (prop_id)    {    case PROP_ACTIVE:      gtk_switch_set_active (sw, g_value_get_boolean (value));      break;    case PROP_RELATED_ACTION:      gtk_switch_set_related_action (sw, g_value_get_object (value));      break;    case PROP_USE_ACTION_APPEARANCE:      gtk_switch_set_use_action_appearance (sw, g_value_get_boolean (value));      break;    default:      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);    }}
开发者ID:BYC,项目名称:gtk,代码行数:26,


示例4: cc_sharing_panel_switch_to_label_transform_func

static gbooleancc_sharing_panel_switch_to_label_transform_func (GBinding       *binding,                                                 const GValue   *source_value,                                                 GValue         *target_value,                                                 CcSharingPanel *self){  gboolean active;  if (!G_VALUE_HOLDS_BOOLEAN (source_value))    return FALSE;  if (!G_VALUE_HOLDS_STRING (target_value))    return FALSE;  active = g_value_get_boolean (source_value);  if (active)    g_value_set_string (target_value, C_("service is enabled", "On"));  else    g_value_set_string (target_value, C_("service is disabled", "Off"));  /* ensure the master switch is active if one of the services is active */  if (active)    gtk_switch_set_active (GTK_SWITCH (self->priv->master_switch), TRUE);  return TRUE;}
开发者ID:mariospr,项目名称:gnome-control-center,代码行数:27,


示例5: nimf_settings_page_key_build_boolean

static GtkWidget *nimf_settings_page_key_build_boolean (NimfSettingsPageKey *page_key){  GtkWidget *gswitch;  GtkWidget *hbox;  gchar     *detailed_signal;  gboolean   is_active;  gswitch = gtk_switch_new ();  is_active = g_settings_get_boolean (page_key->gsettings, page_key->key);  gtk_switch_set_active (GTK_SWITCH (gswitch), is_active);  gtk_widget_set_halign  (gswitch, GTK_ALIGN_END);  detailed_signal = g_strdup_printf ("changed::%s", page_key->key);  g_signal_connect (gswitch, "notify::active",                    G_CALLBACK (on_notify_active), page_key);  g_signal_connect (page_key->gsettings, detailed_signal,                    G_CALLBACK (on_gsettings_changed), gswitch);  g_free (detailed_signal);  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 15);  gtk_box_pack_start (GTK_BOX (hbox), page_key->label, FALSE, FALSE, 0);  gtk_box_pack_end   (GTK_BOX (hbox), gswitch, FALSE, FALSE, 0);  return hbox;}
开发者ID:wcho,项目名称:nimf,代码行数:27,


示例6: device_ethernet_refresh_ui

static voiddevice_ethernet_refresh_ui (NetDeviceEthernet *device){        NMDevice *nm_device;        NMDeviceState state;        GtkWidget *widget;        gchar *speed = NULL;        nm_device = net_device_get_nm_device (NET_DEVICE (device));        widget = GTK_WIDGET (gtk_builder_get_object (device->builder, "label_device"));        gtk_label_set_label (GTK_LABEL (widget), net_object_get_title (NET_OBJECT (device)));        widget = GTK_WIDGET (gtk_builder_get_object (device->builder, "image_device"));        gtk_image_set_from_icon_name (GTK_IMAGE (widget),                                      panel_device_to_icon_name (nm_device, FALSE),                                      GTK_ICON_SIZE_DIALOG);        widget = GTK_WIDGET (gtk_builder_get_object (device->builder, "device_off_switch"));        state = nm_device_get_state (nm_device);        gtk_widget_set_visible (widget,                                state != NM_DEVICE_STATE_UNAVAILABLE                                && state != NM_DEVICE_STATE_UNMANAGED);        device->updating_device = TRUE;        gtk_switch_set_active (GTK_SWITCH (widget), device_state_to_off_switch (state));        device->updating_device = FALSE;        if (state != NM_DEVICE_STATE_UNAVAILABLE)                speed = net_device_simple_get_speed (NET_DEVICE_SIMPLE (device));        panel_set_device_status (device->builder, "label_status", nm_device, speed);        populate_ui (device);}
开发者ID:1dot75cm,项目名称:gnome-control-center,代码行数:33,


示例7: on_perm_store_set_done

static voidon_perm_store_set_done (GObject *source_object,                        GAsyncResult *res,                        gpointer user_data){  LocationAppStateData *data;  GVariant *results;  GError *error = NULL;  results = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object),                                      res,                                      &error);  if (results == NULL)    {      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))        g_warning ("Failed to store permissions: %s", error->message);      g_error_free (error);      return;    }  g_variant_unref (results);  data = (LocationAppStateData *) user_data;  data->changing_state = FALSE;  gtk_switch_set_state (GTK_SWITCH (data->widget), data->pending_state);}
开发者ID:mariospr,项目名称:gnome-control-center,代码行数:26,


示例8: gtk_switch_key_release

static gbooleangtk_switch_key_release (GtkWidget   *widget,                        GdkEventKey *event){  GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;  if (event->keyval == GDK_KEY_Return ||      event->keyval == GDK_KEY_KP_Enter ||      event->keyval == GDK_KEY_ISO_Enter ||      event->keyval == GDK_KEY_space ||      event->keyval == GDK_KEY_KP_Space)    {      gtk_switch_set_active (GTK_SWITCH (widget), !priv->is_active);    }  return FALSE;}
开发者ID:BYC,项目名称:gtk,代码行数:17,


示例9: on_gsettings_changed

static voidon_gsettings_changed (GSettings *settings,                      gchar     *key,                      GtkWidget *widget){  if (GTK_IS_SWITCH (widget))  {    gboolean active1 = g_settings_get_boolean (settings, key);    gboolean active2 = gtk_switch_get_active (GTK_SWITCH (widget));    if (active1 != active2)      gtk_switch_set_active (GTK_SWITCH (widget), active1);  }  else if (GTK_IS_COMBO_BOX (widget))  {    gchar    *id;    gboolean  retval;    id = g_settings_get_string (settings, key);    retval = gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget), id);    if (retval == FALSE && g_strcmp0 (key, "default-engine") == 0)      g_settings_set_string (settings, key, "nimf-system-keyboard");    g_free (id);  }  else if (GTK_IS_TREE_VIEW (widget))  {    GtkTreeModel  *model;    gchar        **vals;    GtkTreeIter    iter;    gint           i;    vals = g_settings_get_strv (settings, key);    model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));    gtk_list_store_clear (GTK_LIST_STORE (model));    for (i = 0; vals[i] != NULL; i++)    {      gtk_list_store_append (GTK_LIST_STORE (model), &iter);      gtk_list_store_set    (GTK_LIST_STORE (model), &iter, 0, vals[i], -1);    }    g_strfreev (vals);  }}
开发者ID:inureyes,项目名称:nimf,代码行数:46,


示例10: change_ntp

static voidchange_ntp (GObject         *gobject,            GParamSpec      *pspec,            CcDateTimePanel *self){  update_widget_state_for_ntp (self, gtk_switch_get_active (GTK_SWITCH (gobject)));  queue_set_ntp (self);}
开发者ID:MM294,项目名称:gnome-control-center,代码行数:8,


示例11: keybinds_conf_save

void keybinds_conf_save (void) {	int i;	int Mod1[HOTKEY_COUNT], Mod2[HOTKEY_COUNT] , Key[HOTKEY_COUNT];	char sMods[5][10] = { "" , "<CTRL>", "<SHIFT>", "<ALT>", "<WIN>" };	char ConfFilePath [512];	FILE *fpConfig = NULL;	#ifdef __linux__	sprintf(ConfFilePath ,"%s/keybinds.ini" ,DirConf);	#elif __WIN32	sprintf(ConfFilePath ,"%s//keybinds.ini" ,DirConf);	#endif	fpConfig = fopen(ConfFilePath , "w");	if (fpConfig == NULL) {		log_error(true,"***Error: Couldn't write to config file 'keybinds.ini'");		return;	}	for ( i = 0 ; i < HOTKEY_COUNT ; ++i) {		Mod1[i] = gtk_combo_box_get_active(GTK_COMBO_BOX(com_kb_mod1[i]));		Mod2[i] = gtk_combo_box_get_active(GTK_COMBO_BOX(com_kb_mod2[i]));		Key[i] = gtk_combo_box_get_active(GTK_COMBO_BOX(com_kb_key[i]));	}	fprintf(fpConfig, "Hotkey_FUP = %s%s%c/n",		Mod1[0] != Mod2[0] ? sMods[Mod1[0]] : "" , sMods[Mod2[0]], Key[0]+33);	fprintf(fpConfig, "Hotkey_SS_A_UP = %s%s%c/n",		Mod1[1] != Mod2[1] ? sMods[Mod1[1]] : "" , sMods[Mod2[1]], Key[1]+33);	fprintf(fpConfig, "Hotkey_SS_W_UP = %s%s%c/n",		Mod1[2] != Mod2[2] ? sMods[Mod1[2]] : "" , sMods[Mod2[2]], Key[2]+33);	fprintf(fpConfig, "Hotkey_SS_F_UP = %s%s%c/n",		Mod1[3] != Mod2[3] ? sMods[Mod1[3]] : "" , sMods[Mod2[3]], Key[3]+33);    fprintf(fpConfig, "Hotkey_SS_A_CAP = %s%s%c/n",		Mod1[4] != Mod2[4] ? sMods[Mod1[4]] : "" , sMods[Mod2[4]], Key[4]+33);	fprintf(fpConfig, "Hotkey_SS_W_CAP = %s%s%c/n",		Mod1[5] != Mod2[5] ? sMods[Mod1[5]] : "" , sMods[Mod2[5]], Key[5]+33);	fprintf(fpConfig, "Hotkey_SS_F_CAP = %s%s%c/n",		Mod1[6] != Mod2[6] ? sMods[Mod1[6]] : "" , sMods[Mod2[6]], Key[6]+33);	fprintf(fpConfig, "Hotkey_OPEN = %s%s%c/n",		Mod1[7] != Mod2[7] ? sMods[Mod1[7]] : "" , sMods[Mod2[7]], Key[7]+33);	fprintf(fpConfig, "Enable_HK_FUP = %d/n", gtk_switch_get_active (GTK_SWITCH(sw_kb[0])));	fprintf(fpConfig, "Enable_HK_SS_A_UP = %d/n", gtk_switch_get_active (GTK_SWITCH(sw_kb[1])));	fprintf(fpConfig, "Enable_HK_SS_W_UP = %d/n", gtk_switch_get_active (GTK_SWITCH(sw_kb[2])));	fprintf(fpConfig, "Enable_HK_SS_F_UP = %d/n",gtk_switch_get_active (GTK_SWITCH(sw_kb[3])));	fprintf(fpConfig, "Enable_HK_SS_A_CAP = %d/n", gtk_switch_get_active (GTK_SWITCH(sw_kb[4])));	fprintf(fpConfig, "Enable_HK_SS_W_CAP = %d/n", gtk_switch_get_active (GTK_SWITCH(sw_kb[5])));	fprintf(fpConfig, "Enable_HK_SS_F_CAP = %d/n", gtk_switch_get_active (GTK_SWITCH(sw_kb[6])));	fprintf(fpConfig, "Enable_HK_OPEN = %d/n",gtk_switch_get_active (GTK_SWITCH(sw_kb[7])));	fclose(fpConfig);	keybinds_window_destroy();	keybinds_conf_load();}
开发者ID:BucketPW,项目名称:pomfit,代码行数:55,


示例12: gtk_switch_motion

static gbooleangtk_switch_motion (GtkWidget      *widget,                   GdkEventMotion *event){  GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;  /* if this is a direct toggle we don't handle motion */  if (priv->in_press)    return GDK_EVENT_PROPAGATE;  if (ABS (event->x - priv->drag_start) < priv->drag_threshold)    return GDK_EVENT_STOP;  if (event->state & GDK_BUTTON1_MASK)    {      gint position = event->x - priv->offset;      GtkAllocation allocation;      GtkStyleContext *context;      GtkStateFlags state;      GtkBorder padding;      gint width, focus_width, focus_pad;      gtk_widget_style_get (widget,                            "focus-line-width", &focus_width,                            "focus-padding", &focus_pad,                            NULL);      context = gtk_widget_get_style_context (widget);      state = gtk_widget_get_state_flags (widget);      gtk_style_context_save (context);      gtk_style_context_add_class (context, GTK_STYLE_CLASS_SLIDER);      gtk_style_context_get_padding (context, state, &padding);      gtk_style_context_restore (context);            gtk_widget_get_allocation (widget, &allocation);      width = allocation.width - 2 * (focus_width + focus_pad);      /* constrain the handle within the trough width */      if (position > (width / 2) - padding.right)        priv->handle_x = width / 2 - padding.right;      else if (position < padding.left)        priv->handle_x = 0;      else        priv->handle_x = position;      priv->is_dragging = TRUE;      /* we need to redraw the handle */      gtk_widget_queue_draw (widget);      return GDK_EVENT_STOP;    }  return GDK_EVENT_PROPAGATE;}
开发者ID:3dfxmadscientist,项目名称:gtk,代码行数:57,


示例13: property_page_commit

static gbooleanproperty_page_commit (PropertyPage *page){  gboolean is_shared;  ShareInfo share_info;  ConfirmPermissionsStatus status;  GError *error;  gboolean retval;  is_shared = gtk_switch_get_active (GTK_SWITCH (page->switch_share_folder));  share_info.path = page->path;  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));  /* Do we need to unset the write permissions that we added in the past? */  if (is_shared && page->was_writable && !share_info.is_writable)    restore_write_permissions (page->path);  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);  if (status == CONFIRM_CANCEL_OR_ERROR)    return FALSE; /* the user didn't want us to change his folder's permissions */  error = NULL;  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);  if (!retval)    {      property_page_set_error (page, error->message);      g_error_free (error);      /* Since the operation failed, we restore things to the way they were */      if (status == CONFIRM_MODIFIED)	restore_saved_permissions (page->path);    }  else    {      property_page_validate_fields (page);      nemo_file_info_invalidate_extension_info (page->fileinfo);    }  if (!is_shared)    restore_saved_permissions (page->path);  /* update initially shared state, so that we may undo later on */  if (retval)    {      page->was_initially_shared = is_shared;      page->is_dirty = FALSE;    }  return retval;}
开发者ID:Fantu,项目名称:nemo-extensions,代码行数:55,


示例14: gtk_switch_leave

static gbooleangtk_switch_leave (GtkWidget        *widget,                  GdkEventCrossing *event){  GtkSwitchPrivate *priv = GTK_SWITCH (widget)->priv;  if (event->window == priv->event_window)    priv->in_switch = FALSE;  return FALSE;}
开发者ID:3dfxmadscientist,项目名称:gtk,代码行数:11,


示例15: flashlight_set_active

/* flashlight_set_active */void flashlight_set_active(Flashlight * flashlight, gboolean active){	flashlightbackend_set(active);	gtk_widget_set_sensitive(flashlight->image, active);#if GTK_CHECK_VERSION(3, 0, 0)	gtk_switch_set_active(GTK_SWITCH(flashlight->co_toggle), active);#else	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(flashlight->co_toggle),			active);#endif}
开发者ID:DeforaOS,项目名称:Flashlight,代码行数:12,


示例16: _flashlight_on_toggled

/* flashlight_on_toggled */static void _flashlight_on_toggled(gpointer data){	Flashlight * flashlight = data;#if GTK_CHECK_VERSION(3, 0, 0)	flashlight_set_active(flashlight, gtk_switch_get_active(				GTK_SWITCH(flashlight->co_toggle)));#else	flashlight_set_active(flashlight, gtk_toggle_button_get_active(				GTK_TOGGLE_BUTTON(flashlight->co_toggle)));#endif}
开发者ID:DeforaOS,项目名称:Flashlight,代码行数:13,


示例17: aspectswitch_toggled_cb

static voidaspectswitch_toggled_cb (GtkWidget           *widget,                         GParamSpec          *pspec,			 CcWacomMappingPanel *self){	GSettings *settings;	settings = gsd_wacom_device_get_settings (self->priv->device);	g_settings_set_boolean (settings,				"keep-aspect",				gtk_switch_get_active (GTK_SWITCH (widget)));}
开发者ID:jigpu,项目名称:gnome-control-center,代码行数:12,


示例18: checkbutton_toggled_cb

static voidcheckbutton_toggled_cb (GtkWidget           *widget,			CcWacomMappingPanel *self){	gboolean active;	active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));	set_combobox_sensitive (self, active);	if (!active)		gtk_switch_set_active (GTK_SWITCH(self->priv->aspectswitch), FALSE);	update_mapping (self);}
开发者ID:jigpu,项目名称:gnome-control-center,代码行数:12,


示例19: setup_touchpad_options

static voidsetup_touchpad_options (CcMousePropertiesPrivate *d){	gboolean edge_scroll_enabled;	gboolean two_finger_scroll_enabled;	gboolean have_two_finger_scrolling;	gboolean have_edge_scrolling;	gboolean have_tap_to_click;	gtk_widget_set_visible (WID ("touchpad-frame"), !d->have_synaptics);	if (d->have_synaptics)		return;	gtk_widget_set_visible (WID ("touchpad-frame"), d->have_touchpad);	if (!d->have_touchpad)		return;	cc_touchpad_check_capabilities (&have_two_finger_scrolling, &have_edge_scrolling, &have_tap_to_click);	gtk_widget_show_all (WID ("touchpad-frame"));	gtk_widget_set_visible (WID ("two-finger-scrolling-row"), have_two_finger_scrolling);	gtk_widget_set_visible (WID ("edge-scrolling-row"), have_edge_scrolling);	gtk_widget_set_visible (WID ("tap-to-click-row"), have_tap_to_click);	edge_scroll_enabled = g_settings_get_boolean (d->touchpad_settings, "edge-scrolling-enabled");	two_finger_scroll_enabled = g_settings_get_boolean (d->touchpad_settings, "two-finger-scrolling-enabled");	if (edge_scroll_enabled && two_finger_scroll_enabled) {		/* You cunning user set both, but you can only have one set in that UI */		d->changing_scroll = TRUE;		gtk_switch_set_active (GTK_SWITCH (WID ("two-finger-scrolling-switch")), two_finger_scroll_enabled);		d->changing_scroll = FALSE;		gtk_switch_set_active (GTK_SWITCH (WID ("edge-scrolling-switch")), FALSE);	} else {		d->changing_scroll = TRUE;		gtk_switch_set_active (GTK_SWITCH (WID ("edge-scrolling-switch")), edge_scroll_enabled);		gtk_switch_set_active (GTK_SWITCH (WID ("two-finger-scrolling-switch")), two_finger_scroll_enabled);		d->changing_scroll = FALSE;	}}
开发者ID:endlessm,项目名称:gnome-control-center,代码行数:40,


示例20: set_left_handed_from_gsettings

static voidset_left_handed_from_gsettings (CcWacomPage *page){	CcWacomPagePrivate	*priv = CC_WACOM_PAGE(page)->priv;	CsdWacomDevice          *device = priv->stylus;	CsdWacomRotation 	display_rotation;	const gchar*		rotation;	display_rotation = csd_wacom_device_get_display_rotation (device);	rotation = g_settings_get_string (priv->wacom_settings, "rotation");	if (strcmp (rotation, csd_wacom_device_rotation_type_to_name (display_rotation)) != 0)		gtk_switch_set_active (GTK_SWITCH (WID ("switch-left-handed")), TRUE);}
开发者ID:chitwanix,项目名称:sagarmatha-control-center,代码行数:13,


示例21: add_routes_section

static voidadd_routes_section (CEPageIP4 *page){        GtkWidget *widget;        GtkWidget *frame;        GtkWidget *list;        gint i;        widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_section"));        frame = gtk_frame_new (NULL);        gtk_container_add (GTK_CONTAINER (widget), frame);        page->routes_list = list = gtk_list_box_new ();        gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);        gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);        gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);        gtk_container_add (GTK_CONTAINER (frame), list);        page->auto_routes = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_routes_switch"));        gtk_switch_set_active (page->auto_routes, !nm_setting_ip4_config_get_ignore_auto_routes (page->setting));        g_signal_connect (page->auto_routes, "notify::active", G_CALLBACK (switch_toggled), page);        add_section_toolbar (page, widget, G_CALLBACK (add_empty_route_row));        for (i = 0; i < nm_setting_ip4_config_get_num_routes (page->setting); i++) {                NMIP4Route *route;                struct in_addr tmp_addr;                gchar address[INET_ADDRSTRLEN + 1];                gchar netmask[INET_ADDRSTRLEN + 1];                gchar gateway[INET_ADDRSTRLEN + 1];                gint metric;                route = nm_setting_ip4_config_get_route (page->setting, i);                if (!route)                        continue;                tmp_addr.s_addr = nm_ip4_route_get_dest (route);                (void) inet_ntop (AF_INET, &tmp_addr, &address[0], sizeof (address));                tmp_addr.s_addr = nm_utils_ip4_prefix_to_netmask (nm_ip4_route_get_prefix (route));                (void) inet_ntop (AF_INET, &tmp_addr, &netmask[0], sizeof (netmask));                tmp_addr.s_addr = nm_ip4_route_get_next_hop (route);                (void) inet_ntop (AF_INET, &tmp_addr, &gateway[0], sizeof (gateway));                metric = nm_ip4_route_get_metric (route);                add_route_row (page, address, netmask, gateway, metric);        }        if (nm_setting_ip4_config_get_num_routes (page->setting) == 0)                add_empty_route_row (page);        gtk_widget_show_all (widget);}
开发者ID:RavetcoFX,项目名称:cinnamon-control-center,代码行数:51,


示例22: cc_bluetooth_panel_update_power

static voidcc_bluetooth_panel_update_power (CcBluetoothPanel *self){	GObject *toggle;	gboolean sensitive, powered, change_powered;	const char *page;	g_debug ("Updating airplane mode: has_airplane_mode %d, hardware_airplane_mode %d, BT airplane_mode %d, airplane_mode %d",		 self->priv->has_airplane_mode, self->priv->hardware_airplane_mode, self->priv->bt_airplane_mode, self->priv->airplane_mode);	change_powered = TRUE;	if (self->priv->has_airplane_mode == FALSE) {		g_debug ("No Bluetooth available");		sensitive = FALSE;		powered = FALSE;		page = BLUETOOTH_NO_DEVICES_PAGE;	} else if (self->priv->hardware_airplane_mode) {		g_debug ("Bluetooth is Hard blocked");		sensitive = FALSE;		powered = FALSE;		page = BLUETOOTH_HW_AIRPLANE_PAGE;	} else if (self->priv->airplane_mode) {		g_debug ("Airplane mode is on, Wi-Fi and Bluetooth are disabled");		sensitive = FALSE;		powered = FALSE;		page = BLUETOOTH_AIRPLANE_PAGE;	} else if (self->priv->bt_airplane_mode ||		   !bluetooth_settings_widget_get_default_adapter_powered (BLUETOOTH_SETTINGS_WIDGET (self->priv->widget))) {		g_debug ("Default adapter is unpowered, but should be available");		sensitive = TRUE;		change_powered = FALSE;		page = BLUETOOTH_DISABLED_PAGE;	} else {		g_debug ("Bluetooth is available and powered");		sensitive = TRUE;		powered = TRUE;		page = BLUETOOTH_WORKING_PAGE;	}	gtk_widget_set_sensitive (WID ("box_power") , sensitive);	toggle = G_OBJECT (WID ("switch_bluetooth"));	if (change_powered) {		g_signal_handlers_block_by_func (toggle, power_callback, self);		gtk_switch_set_active (GTK_SWITCH (toggle), powered);		g_signal_handlers_unblock_by_func (toggle, power_callback, self);	}	gtk_stack_set_visible_child_name (GTK_STACK (self->priv->stack), page);}
开发者ID:kleopatra999,项目名称:gnome-control-center,代码行数:51,



注:本文中的GTK_SWITCH函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GTK_TEXT_BUFFER函数代码示例
C++ GTK_STYLE_PROVIDER函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。