static gboolean
settings_search_is_recursive (NautilusQueryEditor *editor)
{
    NautilusQueryEditorPrivate *priv;
    NautilusFile *file;
    gboolean recursive;

    priv = nautilus_query_editor_get_instance_private (editor);

    if (!priv->location)
    {
        return TRUE;
    }

    file = nautilus_file_get (priv->location);

    if (nautilus_file_is_remote (file))
    {
        recursive = g_settings_get_enum (nautilus_preferences, "recursive-search") == NAUTILUS_SPEED_TRADEOFF_ALWAYS;
    }
    else
    {
        recursive = g_settings_get_enum (nautilus_preferences, "recursive-search") == NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY ||
                    g_settings_get_enum (nautilus_preferences, "recursive-search") == NAUTILUS_SPEED_TRADEOFF_ALWAYS;
    }

    nautilus_file_unref (file);

    return recursive;
}
static void
font_render_load (GSettings *settings)
{
  Antialiasing antialiasing;
  Hinting hinting;
  gboolean inconsistent = TRUE;
  GSList *tmp_list;

  antialiasing = g_settings_get_enum (settings, FONT_ANTIALIASING_KEY);
  hinting = g_settings_get_enum (settings, FONT_HINTING_KEY);

  in_change = TRUE;

  for (tmp_list = font_pairs; tmp_list; tmp_list = tmp_list->next) {
    FontPair *pair = tmp_list->data;

    if (antialiasing == pair->antialiasing && hinting == pair->hinting) {
      gtk_toggle_button_set_active (pair->radio, TRUE);
      inconsistent = FALSE;
      break;
    }
  }

  for (tmp_list = font_pairs; tmp_list; tmp_list = tmp_list->next) {
    FontPair *pair = tmp_list->data;

    gtk_toggle_button_set_inconsistent (pair->radio, inconsistent);
  }

  in_change = FALSE;
}
void mate_wp_item_update (MateWPItem *item) {
  GSettings *settings;
  GdkColor color1 = { 0, 0, 0, 0 }, color2 = { 0, 0, 0, 0 };
  gchar *s;

  settings = g_settings_new (WP_SCHEMA);

  item->options = g_settings_get_enum (settings, WP_OPTIONS_KEY);

  item->shade_type = g_settings_get_enum (settings, WP_SHADING_KEY);

  s = g_settings_get_string (settings, WP_PCOLOR_KEY);
  if (s != NULL) {
    gdk_color_parse (s, &color1);
    g_free (s);
  }

  s = g_settings_get_string (settings, WP_SCOLOR_KEY);
  if (s != NULL) {
    gdk_color_parse (s, &color2);
    g_free (s);
  }

  g_object_unref (settings);

  if (item->pcolor != NULL)
    gdk_color_free (item->pcolor);

  if (item->scolor != NULL)
    gdk_color_free (item->scolor);

  item->pcolor = gdk_color_copy (&color1);
  item->scolor = gdk_color_copy (&color2);
}
Beispiel #4
0
int
main(int argc, char **argv)
{
    MathEquation *equation;
    int accuracy = 9, word_size = 64, base = 10;
    gboolean show_tsep = FALSE, show_zeroes = FALSE;
    DisplayFormat number_format;
    MPAngleUnit angle_units;
    ButtonMode button_mode;
    gchar *source_currency, *target_currency;

    g_type_init();

    bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
    textdomain(GETTEXT_PACKAGE);

    /* Seed random number generator. */
    srand48((long) time((time_t *) 0));

    get_options(argc, argv);

    settings = g_settings_new ("org.mate.calc");
    accuracy = g_settings_get_int(settings, "accuracy");
    word_size = g_settings_get_int(settings, "word-size");
    base = g_settings_get_int(settings, "base");
    show_tsep = g_settings_get_boolean(settings, "show-thousands");
    show_zeroes = g_settings_get_boolean(settings, "show-zeroes");
    number_format = g_settings_get_enum(settings, "number-format");
    angle_units = g_settings_get_enum(settings, "angle-units");
    button_mode = g_settings_get_enum(settings, "button-mode");
    source_currency = g_settings_get_string(settings, "source-currency");
    target_currency = g_settings_get_string(settings, "target-currency");

    equation = math_equation_new();
    math_equation_set_accuracy(equation, accuracy);
    math_equation_set_word_size(equation, word_size);
    math_equation_set_show_thousands_separators(equation, show_tsep);
    math_equation_set_show_trailing_zeroes(equation, show_zeroes);
    math_equation_set_number_format(equation, number_format);
    math_equation_set_angle_units(equation, angle_units);
    math_equation_set_source_currency(equation, source_currency);
    math_equation_set_target_currency(equation, target_currency);
    g_free(source_currency);
    g_free(target_currency);

    gtk_init(&argc, &argv);

    window = math_window_new(equation);
    g_signal_connect(G_OBJECT(window), "quit", G_CALLBACK(quit_cb), NULL);
    math_buttons_set_programming_base(math_window_get_buttons(window), base);
    math_buttons_set_mode(math_window_get_buttons(window), button_mode); // FIXME: We load the basic buttons even if we immediately switch to the next type

    gtk_widget_show(GTK_WIDGET(window));
    gtk_main();

    return(0);
}
Beispiel #5
0
void
image_viewer__dlg_preferences_construct_cb (GtkWidget  *dialog,
					    GthBrowser *browser,
					    GtkBuilder *dialog_builder)
{
	BrowserData *data;
	GtkWidget   *notebook;
	GtkWidget   *page;
	GtkWidget   *label;

	data = g_new0 (BrowserData, 1);
	data->builder = _gtk_builder_new_from_file ("image-viewer-preferences.ui", "image_viewer");
	data->settings = g_settings_new (GTHUMB_IMAGE_VIEWER_SCHEMA);

	notebook = _gtk_builder_get_widget (dialog_builder, "notebook");

	page = _gtk_builder_get_widget (data->builder, "preferences_page");
	g_object_set_data (G_OBJECT (page), "extension-name", "image_viewer");
	gtk_widget_show (page);

	gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("change_zoom_combobox")),
				  g_settings_get_enum (data->settings, PREF_IMAGE_VIEWER_ZOOM_CHANGE));
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("toggle_reset_scrollbars")),
				      g_settings_get_boolean (data->settings, PREF_IMAGE_VIEWER_RESET_SCROLLBARS));

	if (g_settings_get_enum (data->settings, PREF_IMAGE_VIEWER_ZOOM_QUALITY) == GTH_ZOOM_QUALITY_LOW)
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("zoom_quality_low_radiobutton")), TRUE);
	else
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("zoom_quality_high_radiobutton")), TRUE);

	g_signal_connect (GET_WIDGET ("change_zoom_combobox"),
			  "changed",
			  G_CALLBACK (zoom_change_changed_cb),
			  data);
	g_signal_connect (GET_WIDGET ("zoom_quality_low_radiobutton"),
			  "toggled",
			  G_CALLBACK (zoom_quality_radiobutton_toggled_cb),
			  data);
	g_signal_connect (GET_WIDGET ("zoom_quality_high_radiobutton"),
			  "toggled",
			  G_CALLBACK (zoom_quality_radiobutton_toggled_cb),
			  data);
	g_signal_connect (GET_WIDGET ("toggle_reset_scrollbars"),
			  "toggled",
			  G_CALLBACK (reset_scrollbars_toggled_cb),
			  data);

	label = gtk_label_new (_("Viewer"));
	gtk_widget_show (label);

	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label);

	g_object_set_data_full (G_OBJECT (dialog), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
Beispiel #6
0
static void
handle_preference_update_enum (GSettings *settings,
                               gchar *key)
{
    MetaEnumPreference *cursor = preferences_enum;
    gint old_value;

    while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
        ++cursor;

    if (cursor->base.key==NULL)
        /* Didn't recognise that key. */
        return;

    /* We need to know whether the value changes, so
     * store the current value away. */
    old_value = * ((gint *) cursor->target);

    *((gint *) cursor->target) =
        g_settings_get_enum (SETTINGS (cursor->base.schema), key);

    /* Did it change?  If so, tell the listeners about it. */
    if (old_value != *((gint *) cursor->target))
        queue_changed (cursor->base.pref);
}
Beispiel #7
0
gint
tracker_config_get_verbosity (TrackerConfig *config)
{
	g_return_val_if_fail (TRACKER_IS_CONFIG (config), 0);

	return g_settings_get_enum (G_SETTINGS (config), "verbosity");
}
Beispiel #8
0
static void
wallpaper_style_init_from_current (WallpaperStyle *style)
{
	GSettings *settings;
	char      *uri;

	if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Cinnamon") == 0 || g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "X-Cinnamon") == 0) {
		settings = g_settings_new (CINNAMON_DESKTOP_BACKGROUND_SCHEMA);
	}
	else if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "MATE") == 0) {
		settings = g_settings_new (MATE_DESKTOP_BACKGROUND_SCHEMA);
	}
	else {
		settings = g_settings_new (GNOME_DESKTOP_BACKGROUND_SCHEMA);
	}

	if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "MATE") == 0) {
		uri = g_settings_get_string (settings, MATE_DESKTOP_BACKGROUND_FILE_KEY);
	}
	else {
		uri = g_settings_get_string (settings, DESKTOP_BACKGROUND_FILE_KEY);
	}

	style->file = (uri != NULL) ? g_file_new_for_uri (uri) : NULL;
	style->background_style = g_settings_get_enum (settings, DESKTOP_BACKGROUND_STYLE_KEY);


	g_free (uri);
	g_object_unref (settings);
}
void
initialize_app_menubar (GApplication *application)
{
	GtkBuilder *builder;
	GSettings  *settings;

	g_action_map_add_action_entries (G_ACTION_MAP (application),
					 app_menu_entries,
					 G_N_ELEMENTS (app_menu_entries),
					 application);

	builder = _gtk_builder_new_from_resource ("app-menubar.ui");
	gtk_application_set_menubar (GTK_APPLICATION (application),
				     G_MENU_MODEL (gtk_builder_get_object (builder, "app-menubar")));
	g_object_unref (builder);

	settings = fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_UI);
	g_simple_action_set_state (GET_ACTION (PREF_UI_VIEW_SIDEBAR),
				   g_variant_new_boolean (g_settings_get_boolean (settings, PREF_UI_VIEW_SIDEBAR)));

	settings = fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_LISTING);
	g_simple_action_set_state (GET_ACTION (PREF_LISTING_LIST_MODE),
				   g_variant_new_string (_g_enum_type_get_value (FR_TYPE_WINDOW_LIST_MODE,
						   	 g_settings_get_enum (settings, PREF_LISTING_LIST_MODE))->value_nick));

	g_signal_connect (fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_UI),
			  "changed::" PREF_UI_VIEW_SIDEBAR,
			  G_CALLBACK (pref_view_sidebar_changed),
			  application);
	g_signal_connect (fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_LISTING),
			  "changed::" PREF_LISTING_LIST_MODE,
			  G_CALLBACK (pref_list_mode_changed),
			  application);
}
static void
wp_options_changed (GSettings *settings,
                    gchar *key,
                    AppearanceData *data)
{
  MateWPItem *item;
  gchar *option;

  option = g_settings_get_string (settings, key);

  /* "none" means we don't use a background image */
  if (option == NULL || !strcmp (option, "none"))
  {
    /* temporarily disconnect so we don't override settings when
     * updating the selection */
    data->wp_update_settings = FALSE;
    wp_uri_changed ("(none)", data);
    data->wp_update_settings = TRUE;
    if (option)
        g_free (option);
    return;
  }

  item = get_selected_item (data, NULL);

  if (item != NULL)
  {
    item->options = g_settings_get_enum (settings, key);
    wp_option_menu_set (data, item->options, FALSE);
  }
  g_free (option);
}
Beispiel #11
0
/*
 * get_font_family:
 *
 * Return a font description for the font setting. Must be freed.
 */
static PangoFontDescription *
get_font_family(void)
{
	I7App *theapp = i7_app_get();
	GSettings *prefs = i7_app_get_prefs(theapp);

	switch(g_settings_get_enum(prefs, PREFS_FONT_SET)) {
		case FONT_MONOSPACE:
			return get_desktop_monospace_font();
		case FONT_CUSTOM:
		{
			char *customfont = g_settings_get_string(prefs, PREFS_CUSTOM_FONT);
			PangoFontDescription *retval;
			if(customfont) {
				retval = pango_font_description_from_string(customfont);
				g_free(customfont);
				return retval;
			}
			/* else fall through */
		}
		default:
			;
	}
	return get_desktop_standard_font();
}
static void
clock_settings_changed_cb (GSettings       *settings,
                           gchar           *key,
                           CcDateTimePanel *panel)
{
  CcDateTimePanelPrivate *priv = panel->priv;
  GtkWidget *button24h;
  GtkWidget *button12h;
  GDesktopClockFormat value;

  value = g_settings_get_enum (settings, CLOCK_FORMAT_KEY);
  priv->clock_format = value;

  button24h = W ("24h_button");
  button12h = W ("12h_button");

  g_signal_handlers_block_by_func (button24h, change_clock_settings, panel);

  if (value == G_DESKTOP_CLOCK_FORMAT_24H)
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button24h), TRUE);
  else
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button12h), TRUE);

  update_time (panel);

  g_signal_handlers_unblock_by_func (button24h, change_clock_settings, panel);
}
static void
panel_properties_dialog_background_notify (GSettings             *settings,
					   gchar                 *key,
					   PanelPropertiesDialog *dialog)
{
	if (!strcmp (key, "type"))
	{
		PanelBackgroundType type = g_settings_get_enum (settings, key);
		panel_properties_dialog_update_background_type (dialog, type);
	}
	else if (!strcmp (key, "color"))
	{
		char *color = g_settings_get_string (settings, key);
		panel_properties_dialog_update_background_color (dialog, color);
		g_free (color);
	}
	else if (!strcmp (key, "opacity"))
	{
		gint opacity = g_settings_get_int (settings, key);
		panel_properties_dialog_update_background_opacity (dialog, opacity);
	}
	else if (!strcmp (key, "image"))
	{
		char *image = g_settings_get_string (settings, key);
		panel_properties_dialog_update_background_image (dialog, image);
		g_free (image);
	}
}
static void
clock_settings_changed_cb (GSettings       *settings,
                           gchar           *key,
                           CcDateTimePanel *panel)
{
  CcDateTimePanelPrivate *priv = panel->priv;
  GtkWidget *format_combo;
  GDesktopClockFormat value;

  value = g_settings_get_enum (settings, CLOCK_FORMAT_KEY);
  priv->clock_format = value;

  format_combo = W ("format_combobox");

  g_signal_handlers_block_by_func (format_combo, change_clock_settings, panel);

  if (value == G_DESKTOP_CLOCK_FORMAT_24H)
    gtk_combo_box_set_active_id (GTK_COMBO_BOX (format_combo), "24h");
  else
    gtk_combo_box_set_active_id (GTK_COMBO_BOX (format_combo), "12h");

  update_time (panel);

  g_signal_handlers_unblock_by_func (format_combo, change_clock_settings, panel);
}
static void
panel_properties_dialog_background_type_update (PanelPropertiesDialog *dialog)
{
	PanelBackgroundType  background_type;
	GtkWidget           *active_radio;

	background_type = g_settings_get_enum (dialog->settings_background,
					       PANEL_BACKGROUND_TYPE_KEY);

	switch (background_type) {
	case PANEL_BACK_NONE:
		active_radio = dialog->default_radio;
		break;
	case PANEL_BACK_COLOR:
		active_radio = dialog->color_radio;
		break;
	case PANEL_BACK_IMAGE:
		active_radio = dialog->image_radio;
		break;
	default:
		active_radio = NULL;
		g_assert_not_reached ();
		break;
	}

	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (active_radio), TRUE);

	panel_properties_dialog_background_sensitivity_update (dialog, background_type);
}
inline static void
tracker_gsettings_print_verbosity (GSList   *all,
                                   gint      longest,
                                   gboolean  miners)
{
	GSList *l;

	for (l = all; l; l = l->next) {
		ComponentGSettings *c;
		TrackerVerbosity v;

		c = l->data;

		if (c->is_miner == miners) {
			continue;
		}

		v = g_settings_get_enum (c->settings, "verbosity");

		g_print ("  %-*.*s: %s\n",
		         longest,
		         longest,
		         c->name,
		         verbosity_to_string (v));
	}
}
Beispiel #17
0
PRIVATE gboolean update_workarea_size(GSettings* dock_gsettings)
{
    int x, y, width, height;
    get_workarea_size(&x, &y, &width, &height);
    if (width == 0 || height == 0) {
        g_timeout_add(200, (GSourceFunc)update_workarea_size, dock_gsettings);
        return FALSE;
    }

    int  hide_mode = g_settings_get_enum (dock_gsettings, DOCK_HIDE_MODE);
    g_debug ("hide mode: %d", hide_mode);
    if ((hide_mode==HIDE_MODE_AUTOHIDDEN)||
	(hide_mode==HIDE_MODE_INTELLIGENT))
    {
        //reserve the bottom (60 x width) area even dock is not show
        int root_height = gdk_screen_get_height (gdk_screen_get_default ());
        if (y + height + 60 > root_height)
            height = root_height - 60 -y;
    }

    JSObjectRef workarea_info = json_create();
    json_append_number(workarea_info, "x", x);
    json_append_number(workarea_info, "y", y);
    json_append_number(workarea_info, "width", width);
    json_append_number(workarea_info, "height", height);
    js_post_message("workarea_changed", workarea_info);

    return FALSE;
}
Beispiel #18
0
/* Return the font size in Pango units for the font size setting */
gint
get_font_size(PangoFontDescription *font)
{
	I7App *theapp = i7_app_get();
	double size = pango_font_description_get_size(font);

	if(pango_font_description_get_size_is_absolute(font))
		size *= 96.0 / 72.0; /* a guess; not likely to be absolute anyway */
	if(size == 0.0)
		size = DEFAULT_SIZE_STANDARD * PANGO_SCALE;

	switch(g_settings_get_enum(i7_app_get_prefs(theapp), PREFS_FONT_SIZE)) {
		case FONT_SIZE_MEDIUM:
			size *= RELATIVE_SIZE_MEDIUM;
			break;
		case FONT_SIZE_LARGE:
			size *= RELATIVE_SIZE_LARGE;
			break;
		case FONT_SIZE_HUGE:
			size *= RELATIVE_SIZE_HUGE;
			break;
		default:
			size *= RELATIVE_SIZE_STANDARD;
	}
	return size;
}
Beispiel #19
0
/*
 * update_tabs_visibility: Hide tabs if there is only one tab
 * and the pref is not set or when in application mode.
 */
static void
update_tabs_visibility (EphyNotebook *nb,
                        gboolean      before_inserting)
{
  EphyEmbedShellMode mode;
  gboolean show_tabs = FALSE;
  guint num;
  EphyPrefsUITabsBarVisibilityPolicy policy;

  mode = ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (ephy_shell_get_default ()));
  num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb));

  if (before_inserting)
    num++;

  policy = g_settings_get_enum (EPHY_SETTINGS_UI,
                                EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY);

  if (mode != EPHY_EMBED_SHELL_MODE_APPLICATION &&
      nb->adaptive_mode != EPHY_ADAPTIVE_MODE_NARROW &&
      ((policy == EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY_MORE_THAN_ONE && num > 1) ||
        policy == EPHY_PREFS_UI_TABS_BAR_VISIBILITY_POLICY_ALWAYS))
    show_tabs = TRUE;

  /* Only show the tabs when the "tabs-allowed" property is TRUE. */
  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), nb->tabs_allowed && show_tabs);
}
Beispiel #20
0
void
initialize_app_menu (GApplication *application)
{
	GSettings *settings;

	g_action_map_add_action_entries (G_ACTION_MAP (application),
					 app_menu_entries,
					 G_N_ELEMENTS (app_menu_entries),
					 application);
	_gtk_application_add_accelerators (GTK_APPLICATION (application), fr_app_accelerators, G_N_ELEMENTS (fr_app_accelerators));

	settings = fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_UI);
	g_simple_action_set_state (GET_ACTION (PREF_UI_VIEW_SIDEBAR),
				   g_variant_new_boolean (g_settings_get_boolean (settings, PREF_UI_VIEW_SIDEBAR)));

	settings = fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_LISTING);
	g_simple_action_set_state (GET_ACTION (PREF_LISTING_LIST_MODE),
				   g_variant_new_string (_g_enum_type_get_value (FR_TYPE_WINDOW_LIST_MODE,
						   	 g_settings_get_enum (settings, PREF_LISTING_LIST_MODE))->value_nick));

	g_signal_connect (fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_UI),
			  "changed::" PREF_UI_VIEW_SIDEBAR,
			  G_CALLBACK (pref_view_sidebar_changed),
			  application);
	g_signal_connect (fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_LISTING),
			  "changed::" PREF_LISTING_LIST_MODE,
			  G_CALLBACK (pref_list_mode_changed),
			  application);
}
static gchar *
get_proxy_ftp (GsPlugin *plugin)
{
	GsPluginData *priv = gs_plugin_get_data (plugin);
	GString *string = NULL;
	guint port;
	GDesktopProxyMode proxy_mode;
	g_autofree gchar *host = NULL;

	proxy_mode = g_settings_get_enum (priv->settings, "mode");
	if (proxy_mode != G_DESKTOP_PROXY_MODE_MANUAL)
		return NULL;

	host = g_settings_get_string (priv->settings_ftp, "host");
	if (host == NULL)
		return NULL;
	port = g_settings_get_int (priv->settings_ftp, "port");
	if (port == 0)
		return NULL;

	/* make PackageKit proxy string */
	string = g_string_new (host);
	if (port > 0)
		g_string_append_printf (string, ":%i", port);
	return g_string_free (string, FALSE);
}
Beispiel #22
0
GthToolbarStyle
gth_pref_get_real_toolbar_style (void)
{
	GSettings       *settings;
	GthToolbarStyle  toolbar_style;

	settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
	toolbar_style = g_settings_get_enum (settings, PREF_BROWSER_TOOLBAR_STYLE);
	if (toolbar_style == GTH_TOOLBAR_STYLE_SYSTEM) {
		char *system_style;

		toolbar_style = GTH_TOOLBAR_STYLE_TEXT_BELOW; /* default value */

		g_object_unref (settings);
		settings = g_settings_new (GNOME_DESKTOP_INTERFACE_SCHEMA);

		system_style = g_settings_get_string (settings, "toolbar-style");
		if (g_strcmp0 (system_style, "both") == 0)
			toolbar_style = GTH_TOOLBAR_STYLE_TEXT_BELOW;
		else if (g_strcmp0 (system_style, "both-horiz") == 0)
			toolbar_style = GTH_TOOLBAR_STYLE_TEXT_BESIDE;
		else if (g_strcmp0 (system_style, "icons") == 0)
			toolbar_style = GTH_TOOLBAR_STYLE_ICONS;
		else if (g_strcmp0 (system_style, "text") == 0)
			toolbar_style = GTH_TOOLBAR_STYLE_TEXT;

		g_free (system_style);
	}

	g_object_unref (settings);

	return toolbar_style;
}
static void
gcal_application_activate (GApplication *application)
{
  GcalApplicationPrivate *priv;
  priv = GCAL_APPLICATION (application)->priv;

  if (priv->window != NULL)
    {
      gtk_window_present (GTK_WINDOW (priv->window));
    }
  else
    {
      priv->window =
        gcal_window_new_with_view (GCAL_APPLICATION (application),
                                   g_settings_get_enum (priv->settings,
                                                        "active-view"));
      g_settings_bind (priv->settings,
                       "active-view",
                       priv->window,
                       "active-view",
                       G_SETTINGS_BIND_SET | G_SETTINGS_BIND_GET);
      gtk_window_set_title (GTK_WINDOW (priv->window), _("Calendar"));
      gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (priv->window),
                                                   TRUE);

      gtk_window_maximize (GTK_WINDOW (priv->window));
      gtk_widget_show_all (priv->window);
    }
}
Beispiel #24
0
gchar *
gl_util_boot_time_to_display (guint64 realtime_first,
                              guint64 realtime_last)
{
    gchar *time_first;
    gchar *time_last;
    gchar *time_display;
    GDateTime *now;
    GSettings *settings;
    GlUtilClockFormat clock_format;

    /* TODO: Monitor and propagate any GSettings changes. */
    settings = g_settings_new (DESKTOP_SCHEMA);
    clock_format = g_settings_get_enum (settings, CLOCK_FORMAT);

    g_object_unref (settings);

    now = g_date_time_new_now_local ();
    time_first = gl_util_timestamp_to_display (realtime_first,
                                               now, clock_format, FALSE);
    time_last = gl_util_timestamp_to_display (realtime_last,
                                              now, clock_format, FALSE);

    /* Transltors: the first string is the earliest timestamp of the boot,
     * and the second string is the newest timestamp. An example string might
     * be '08:10 - 08:30' */
    time_display = g_strdup_printf (_("%s – %s"), time_first, time_last);

    g_date_time_unref (now);
    g_free (time_first);
    g_free (time_last);

    return time_display;
}
static void
mail_attachment_handler_reply (EAttachmentHandler *handler,
                               EMailReplyType reply_type)
{
	EMailAttachmentHandlerPrivate *priv;
	GSettings *settings;
	EMailReplyStyle style;
	CamelMimeMessage *message;
	EShellBackend *shell_backend;
	EShell *shell;

	priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler);

	message = mail_attachment_handler_get_selected_message (handler);
	g_return_if_fail (message != NULL);

	settings = e_util_ref_settings ("org.gnome.evolution.mail");
	style = g_settings_get_enum (settings, "reply-style-name");
	g_object_unref (settings);

	shell_backend = E_SHELL_BACKEND (priv->backend);
	shell = e_shell_backend_get_shell (shell_backend);

	em_utils_reply_to_message (
		shell, message, NULL, NULL, reply_type, style, NULL, NULL);

	g_object_unref (message);
}
static void
panel_properties_dialog_orientation_update (PanelPropertiesDialog *dialog)
{
	PanelOrientation      orientation;
	GtkTreeModel         *model;
	GtkTreeIter           iter;
	OrientationComboItem *item;

	orientation = g_settings_get_enum (dialog->settings,
					   PANEL_TOPLEVEL_ORIENTATION_KEY);

	/* change the maximum size of the panel */
	panel_properties_size_spin_update_range (dialog);

	/* update the orientation combo box */
	model = gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->orientation_combo));

	if (!gtk_tree_model_get_iter_first (model, &iter))
		return;

	do {
		gtk_tree_model_get (model, &iter, COLUMN_ITEM, &item, -1);
		if (item != NULL && item->orientation == orientation) {
			gtk_combo_box_set_active_iter (GTK_COMBO_BOX (dialog->orientation_combo),
						       &iter);
			return;
		}
	} while (gtk_tree_model_iter_next (model, &iter));
}
Beispiel #27
0
static void
fm_list_view_zoom_normal (FMDirectoryView *view)
{
    MarlinZoomLevel     zoom;
    
    zoom = g_settings_get_enum (marlin_list_view_settings, "default-zoom-level");
    g_settings_set_enum (marlin_list_view_settings, "zoom-level", zoom);
}
static gboolean
get_touchpad_enabled (GSettings *settings)
{
        GDesktopDeviceSendEvents send_events;

        send_events = g_settings_get_enum (settings, "send-events");

        return send_events == G_DESKTOP_DEVICE_SEND_EVENTS_ENABLED;
}
Beispiel #29
0
JS_EXPORT_API
double guide_get_dock_displaymode()
{
    GSettings* settings = g_settings_new (DOCK_SCHEMA_ID);
    int  display_mode = g_settings_get_enum (settings, DISPLAY_MODE_KEY);
    g_debug ("[%s]: %d",__func__ ,display_mode);
    g_object_unref(settings);
    return display_mode;
}
static void
mouse_focus_changed_callback (GSettings *settings,
                              const gchar *key,
                              gpointer user_data)
{
    if (g_settings_get_enum (settings, key) == FOCUS_MODE_MOUSE) {
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (focus_mode_checkbutton), TRUE);
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (focus_mode_mouse_checkbutton), TRUE);
    }
    else if (g_settings_get_enum (settings, key) == FOCUS_MODE_SLOPPY) {
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (focus_mode_checkbutton), TRUE);
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (focus_mode_mouse_checkbutton), FALSE);
    }
    else {
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (focus_mode_checkbutton), FALSE);
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (focus_mode_mouse_checkbutton), FALSE);
    }
}