Esempio n. 1
0
static gboolean
set_background_image_from_uri (PanelToplevel *toplevel,
			       const char    *uri)
{
	GFile     *file;
	GSettings *settings;

	file = g_file_new_for_uri (uri);
	if (!g_file_is_native (file)) {
		g_object_unref (file);
		return FALSE;
	}
	g_object_unref (file);

	settings = get_settings_background_for_toplevel (toplevel);

	if (!g_settings_is_writable (settings,
				     PANEL_BACKGROUND_TYPE_KEY) ||
	    !g_settings_is_writable (settings,
				     PANEL_BACKGROUND_IMAGE_URI_KEY)) {
		g_object_unref (settings);
		return FALSE;
	}

	g_settings_set_string (settings, PANEL_BACKGROUND_IMAGE_URI_KEY, uri);
	g_settings_set_enum (settings, PANEL_BACKGROUND_TYPE_KEY, PANEL_BACK_IMAGE);

	g_object_unref (settings);

	return FALSE;
}
Esempio n. 2
0
gboolean
panel_layout_is_writable (void)
{
        return (g_settings_is_writable (layout_settings,
                                        PANEL_LAYOUT_TOPLEVEL_ID_LIST_KEY) &&
                g_settings_is_writable (layout_settings,
                                        PANEL_LAYOUT_OBJECT_ID_LIST_KEY));
}
static char *
config_get_theme (gboolean *is_writable)
{
	GSettings *settings;
	char        *name;
	int          mode;

	settings = g_settings_new (GSETTINGS_SCHEMA);

	if (is_writable)
	{
		gboolean can_write_theme;
		gboolean can_write_mode;

		can_write_theme = g_settings_is_writable (settings,
		                                          KEY_THEMES);
		can_write_mode = g_settings_is_writable (settings,
		                                         KEY_MODE);
		*is_writable = can_write_theme && can_write_mode;
	}

	mode = config_get_mode (NULL);

	name = NULL;
	if (mode == GS_MODE_BLANK_ONLY)
	{
		name = g_strdup ("__blank-only");
	}
	else if (mode == GS_MODE_RANDOM)
	{
		name = g_strdup ("__random");
	}
	else
	{
		 gchar **strv;
                 strv = g_settings_get_strv (settings,
                                             KEY_THEMES);
                 if (strv != NULL) {
                          name = g_strdup (strv[0]);
		}
		else
		{
			/* TODO: handle error */
			/* default to blank */
			name = g_strdup ("__blank-only");
		}

		g_strfreev (strv);
	}

	g_object_unref (settings);

	return name;
}
Esempio n. 4
0
gboolean
panel_applet_can_freely_move (AppletInfo *applet)
{
	/* if we check for more lockdown than this, then we'll need to update
	 * callers that use panel_lockdown_on_notify() */
	if (panel_lockdown_get_panels_locked_down_s ())
		return FALSE;

	return (g_settings_is_writable (applet->settings,
					PANEL_OBJECT_TOPLEVEL_ID_KEY) &&
	        g_settings_is_writable (applet->settings,
					PANEL_OBJECT_PACK_TYPE_KEY) &&
	        g_settings_is_writable (applet->settings,
					PANEL_OBJECT_PACK_INDEX_KEY));
}
static void
panel_properties_dialog_opacity_scale_setup (PanelPropertiesDialog *dialog,
					     GtkBuilder            *gui)
{
	GtkWidget *opacity_label;
	GtkWidget *opacity_legend;

	dialog->opacity_scale = PANEL_GTK_BUILDER_GET (gui, "opacity_scale");
	g_return_if_fail (dialog->opacity_scale != NULL);
	opacity_label = PANEL_GTK_BUILDER_GET (gui, "opacity_label");
	g_return_if_fail (opacity_label != NULL);
	opacity_legend = PANEL_GTK_BUILDER_GET (gui, "opacity_legend");
	g_return_if_fail (opacity_legend != NULL);

	panel_properties_dialog_background_color_update (dialog);

	g_signal_connect_swapped (dialog->opacity_scale, "value_changed",
				  G_CALLBACK (panel_properties_dialog_opacity_scale_changed),
				  dialog);

	g_settings_bind_writable (dialog->settings_background,
				  PANEL_BACKGROUND_COLOR_KEY,
				  opacity_label, "sensitive", FALSE);
	g_settings_bind_writable (dialog->settings_background,
				  PANEL_BACKGROUND_COLOR_KEY,
				  opacity_legend, "sensitive", FALSE);
	g_settings_bind_writable (dialog->settings_background,
				  PANEL_BACKGROUND_COLOR_KEY,
				  dialog->opacity_scale, "sensitive", FALSE);

	if (!g_settings_is_writable (dialog->settings_background,
				     PANEL_BACKGROUND_COLOR_KEY))
		gtk_widget_show (dialog->writability_warn_background);
}
static void
panel_properties_dialog_color_button_setup (PanelPropertiesDialog *dialog,
					    GtkBuilder            *gui)
{
	GtkWidget *color_label;

	dialog->color_button = PANEL_GTK_BUILDER_GET (gui, "color_button");
	g_return_if_fail (dialog->color_button != NULL);
	color_label = PANEL_GTK_BUILDER_GET (gui, "color_label");
	g_return_if_fail (color_label != NULL);

	panel_properties_dialog_background_color_update (dialog);

	g_signal_connect_swapped (dialog->color_button, "color_set",
				  G_CALLBACK (panel_properties_dialog_color_button_changed),
				  dialog);

	g_settings_bind_writable (dialog->settings_background,
				  PANEL_BACKGROUND_COLOR_KEY,
				  color_label, "sensitive", FALSE);
	g_settings_bind_writable (dialog->settings_background,
				  PANEL_BACKGROUND_COLOR_KEY,
				  dialog->color_button, "sensitive", FALSE);

	if (!g_settings_is_writable (dialog->settings_background,
				     PANEL_BACKGROUND_COLOR_KEY))
		gtk_widget_show (dialog->writability_warn_background);
}
Esempio n. 7
0
static void
get_chartable (charpick_data *curr_data)
{
	MatePanelApplet *applet = MATE_PANEL_APPLET (curr_data->applet);
	gint i, n;
	GList *value = NULL;
	
	value = mate_panel_applet_settings_get_glist (curr_data->settings, "chartable");
	if (value) {
		curr_data->chartable = value;
	}
	else {
		n = G_N_ELEMENTS (chartable);
		for (i=0; i<n; i++) {
			gchar *string;
		
			string = g_ucs4_to_utf8 (chartable[i], -1, NULL, NULL, NULL);
			curr_data->chartable = g_list_append (curr_data->chartable, string);
		
		}
		if ( ! g_settings_is_writable (curr_data->settings, "chartable"))
			save_chartable (curr_data);
	}
	

}
Esempio n. 8
0
static void setup_sensitivity(TasklistData* tasklist, GtkBuilder* builder, const char* wid1, const char* wid2, const char* wid3, const char* key)
{
	MatePanelApplet* applet = MATE_PANEL_APPLET(tasklist->applet);
	GtkWidget* w;

	if (g_settings_is_writable(tasklist->settings, key))
	{
		return;
	}

	w = WID(wid1);
	g_assert(w != NULL);
	gtk_widget_set_sensitive(w, FALSE);

	if (wid2 != NULL)
	{
		w = WID(wid2);
		g_assert(w != NULL);
		gtk_widget_set_sensitive(w, FALSE);
	}

	if (wid3 != NULL)
	{
		w = WID(wid3);
		g_assert(w != NULL);
		gtk_widget_set_sensitive(w, FALSE);
	}
}
static void
nemo_file_management_properties_dialog_setup_icon_caption_page (GtkBuilder *builder)
{
	GList *columns;
	int i;
	gboolean writable;

	writable = g_settings_is_writable (nemo_icon_view_preferences,
					   NEMO_PREFERENCES_ICON_VIEW_CAPTIONS);

	columns = nemo_get_common_columns ();

	for (i = 0; icon_captions_components[i] != NULL; i++) {
		GtkWidget *combo_box;

		combo_box = GTK_WIDGET (gtk_builder_get_object (builder,
								icon_captions_components[i]));

		create_icon_caption_combo_box_items (GTK_COMBO_BOX_TEXT (combo_box), columns);
		gtk_widget_set_sensitive (combo_box, writable);

		g_signal_connect (combo_box, "changed",
				  G_CALLBACK (icon_captions_changed_callback),
				  builder);
	}

	nemo_column_list_free (columns);

	update_icon_captions_from_settings (builder);
}
/* Menu Callback: Lock/Unlock sticky notes */
void menu_toggle_lock_cb(GtkAction *action, StickyNotesApplet *applet)
{
	gboolean locked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));

	if (g_settings_is_writable (stickynotes->settings, "locked"))
		g_settings_set_boolean (stickynotes->settings, "locked", locked);
}
static void
wp_shade_type_changed (GtkWidget *combobox,
                       AppearanceData *data)
{
  MateWPItem *item;
  GtkTreeIter iter;
  GdkPixbuf *pixbuf;

  item = get_selected_item (data, &iter);

  if (item == NULL)
    return;

  item->shade_type = gtk_combo_box_get_active (GTK_COMBO_BOX (data->wp_color_menu));

  pixbuf = mate_wp_item_get_thumbnail (item, data->thumb_factory,
                                        data->thumb_width,
                                        data->thumb_height);
  gtk_list_store_set (GTK_LIST_STORE (data->wp_model), &iter, 0, pixbuf, -1);
  if (pixbuf != NULL)
    g_object_unref (pixbuf);

  if (g_settings_is_writable (data->wp_settings, WP_SHADING_KEY))
    g_settings_set_enum (data->wp_settings, WP_SHADING_KEY, item->shade_type);
}
Esempio n. 12
0
static void
panel_properties_dialog_size_spin_setup (PanelPropertiesDialog *dialog,
					 GtkBuilder            *gui)
{
	GtkWidget *size_label;
	GtkWidget *size_label_pixels;

	dialog->size_spin = PANEL_GTK_BUILDER_GET (gui, "size_spin");
	g_return_if_fail (dialog->size_spin != NULL);
	size_label = PANEL_GTK_BUILDER_GET (gui, "size_label");
	g_return_if_fail (size_label != NULL);
	size_label_pixels = PANEL_GTK_BUILDER_GET (gui, "size_label_pixels");
	g_return_if_fail (size_label_pixels != NULL);

	panel_properties_size_spin_update_range (dialog);

	g_settings_bind (dialog->settings, PANEL_TOPLEVEL_SIZE_KEY,
			 dialog->size_spin, "value",
			 G_SETTINGS_BIND_DEFAULT);

	g_settings_bind_writable (dialog->settings, PANEL_TOPLEVEL_SIZE_KEY,
				  size_label, "sensitive", FALSE);
	g_settings_bind_writable (dialog->settings, PANEL_TOPLEVEL_SIZE_KEY,
				  size_label_pixels, "sensitive", FALSE);

	if (!g_settings_is_writable (dialog->settings, PANEL_TOPLEVEL_SIZE_KEY))
		gtk_widget_show (dialog->writability_warn_general);
}
Esempio n. 13
0
static void
setup_sensitivity(PagerData* pager, GtkBuilder* builder, const char* wid1, const char* wid2, const char* wid3, GSettings* settings, const char* key)
{
	GtkWidget* w;

	if ((settings != NULL) && g_settings_is_writable(settings, key))
	{
		return;
	}

	w = WID(wid1);
	g_assert(w != NULL);
	g_object_set_data(G_OBJECT(w), NEVER_SENSITIVE, GINT_TO_POINTER(1));
	gtk_widget_set_sensitive(w, FALSE);

	if (wid2 != NULL)
	{
		w = WID(wid2);
		g_assert(w != NULL);
		g_object_set_data(G_OBJECT(w), NEVER_SENSITIVE, GINT_TO_POINTER(1));
		gtk_widget_set_sensitive(w, FALSE);
	}

	if (wid3 != NULL)
	{
		w = WID(wid3);
		g_assert(w != NULL);
		g_object_set_data(G_OBJECT(w), NEVER_SENSITIVE, GINT_TO_POINTER(1));
		gtk_widget_set_sensitive(w, FALSE);
	}
}
static gint32
config_get_activate_delay (gboolean *is_writable)
{
	GSettings *settings;
	gint32       delay;

	settings = g_settings_new (GSETTINGS_SCHEMA);

	if (is_writable)
	{
		*is_writable = g_settings_is_writable (settings,
		               KEY_ACTIVATE_DELAY);
	}

	delay = g_settings_get_int (settings, KEY_ACTIVATE_DELAY);

	if (delay < 1)
	{
		delay = 1;
	}

	g_object_unref (settings);

	return delay;
}
Esempio n. 15
0
gboolean
mate_panel_applet_can_freely_move (AppletInfo *applet)
{
	if (panel_lockdown_get_locked_down ())
		return FALSE;

	if (!g_settings_is_writable (applet->settings, PANEL_OBJECT_POSITION_KEY))
		return FALSE;

	if (!g_settings_is_writable (applet->settings, PANEL_OBJECT_TOPLEVEL_ID_KEY))
		return FALSE;

	if (!g_settings_is_writable (applet->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY))
		return FALSE;

	return TRUE;
}
/* Preferences Callback : Save. */
void
preferences_save_cb (gpointer data)
{
	gint width = gtk_adjustment_get_value (stickynotes->w_prefs_width);
	gint height = gtk_adjustment_get_value (stickynotes->w_prefs_height);
	gboolean sys_color = gtk_toggle_button_get_active (
			GTK_TOGGLE_BUTTON (stickynotes->w_prefs_sys_color));
	gboolean sys_font = gtk_toggle_button_get_active (
			GTK_TOGGLE_BUTTON (stickynotes->w_prefs_sys_font));
	gboolean sticky = gtk_toggle_button_get_active (
			GTK_TOGGLE_BUTTON (stickynotes->w_prefs_sticky));
	gboolean force_default = gtk_toggle_button_get_active (
			GTK_TOGGLE_BUTTON (stickynotes->w_prefs_force));
	gboolean desktop_hide = gtk_toggle_button_get_active (
			GTK_TOGGLE_BUTTON (stickynotes->w_prefs_desktop));

	if (g_settings_is_writable (stickynotes->settings,"default-width"))
		g_settings_set_int (stickynotes->settings,"default-width", width);
	if (g_settings_is_writable (stickynotes->settings,"default-height"))
		g_settings_set_int (stickynotes->settings,"default-height", height);
	if (g_settings_is_writable (stickynotes->settings,"use-system-color"))
		g_settings_set_boolean (stickynotes->settings,"use-system-color", sys_color);
	if (g_settings_is_writable (stickynotes->settings,"use-system-font"))
		g_settings_set_boolean (stickynotes->settings,"use-system-font", sys_font);
	if (g_settings_is_writable (stickynotes->settings,"sticky"))
		g_settings_set_boolean (stickynotes->settings,"sticky", sticky);
	if (g_settings_is_writable (stickynotes->settings,"force-default"))
		g_settings_set_boolean (stickynotes->settings,"force-default", force_default);
	if (g_settings_is_writable (stickynotes->settings,"desktop-hide"))
		g_settings_set_boolean (stickynotes->settings,"desktop-hide", desktop_hide);
}
Esempio n. 17
0
gboolean
mate_panel_applet_lockable (AppletInfo *applet)
{
	if (panel_lockdown_get_locked_down ())
		return FALSE;


	return g_settings_is_writable (applet->settings, PANEL_OBJECT_LOCKED_KEY);
}
Esempio n. 18
0
static void
panel_properties_dialog_setup_orientation_combo (PanelPropertiesDialog *dialog,
						 GtkBuilder            *gui)
{
	GtkWidget        *orientation_label;
	GtkListStore     *model;
	GtkTreeIter       iter;
	GtkCellRenderer  *renderer;
	int               i;

	dialog->orientation_combo = PANEL_GTK_BUILDER_GET (gui, "orientation_combo");
	g_return_if_fail (dialog->orientation_combo != NULL);
	orientation_label = PANEL_GTK_BUILDER_GET (gui, "orientation_label");
	g_return_if_fail (orientation_label != NULL);

	model = gtk_list_store_new (NUMBER_COLUMNS,
				    G_TYPE_STRING,
				    G_TYPE_POINTER);

	gtk_combo_box_set_model (GTK_COMBO_BOX (dialog->orientation_combo),
				 GTK_TREE_MODEL (model));

	for (i = 0; i < G_N_ELEMENTS (orientation_items); i++) {
		gtk_list_store_append (model, &iter);
		gtk_list_store_set (model, &iter,
				    COLUMN_TEXT, g_dpgettext2 (NULL, "Orientation", orientation_items [i].name),
				    COLUMN_ITEM, &(orientation_items [i]),
				    -1);
	}

	renderer = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (dialog->orientation_combo),
				    renderer, TRUE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (dialog->orientation_combo),
					renderer, "text", COLUMN_TEXT, NULL);

	panel_properties_dialog_orientation_update (dialog);

	g_signal_connect_swapped (dialog->orientation_combo, "changed",
				  G_CALLBACK (panel_properties_dialog_orientation_changed),
				  dialog);
	g_signal_connect (dialog->settings_background,
			  "changed::"PANEL_TOPLEVEL_ORIENTATION_KEY,
			  G_CALLBACK (panel_properties_dialog_orientation_setting_changed),
			  dialog);

	g_settings_bind_writable (dialog->settings, PANEL_TOPLEVEL_ORIENTATION_KEY,
				  orientation_label, "sensitive", FALSE);
	g_settings_bind_writable (dialog->settings, PANEL_TOPLEVEL_ORIENTATION_KEY,
				  dialog->orientation_combo, "sensitive", FALSE);

	if (!g_settings_is_writable (dialog->settings, PANEL_TOPLEVEL_ORIENTATION_KEY))
		gtk_widget_show (dialog->writability_warn_general);
}
Esempio n. 19
0
/* load_history indicates whether the history list is being loaded at startup.
** If true then don't save the new entries with gconf (since they are being read
** using gconf
*/
void
append_history_entry(MCData *mcdata, const char * entry, gboolean load_history)
{
    GArray *history;
    int pos, i;

    /* remove older dupes */
    for(pos = 0; pos <= MC_HISTORY_LIST_LENGTH - 1; pos++)
	{
	    if(exists_history_entry(pos) && strcmp(entry, history_command[pos]) == 0)
		/* dupe found */
		delete_history_entry(pos);
	}

    /* delete oldest entry */
    if(history_command[0] != NULL)
	free(history_command[0]);

    /* move entries */
    for(pos = 0; pos < MC_HISTORY_LIST_LENGTH - 1; pos++)
	{
	    history_command[pos] = history_command[pos+1];
	    /* printf("%s\n", history_command[pos]); */
	}

    /* append entry */
    history_command[MC_HISTORY_LIST_LENGTH - 1] = (char *)malloc(sizeof(char) * (strlen(entry) + 1));
    strcpy(history_command[MC_HISTORY_LIST_LENGTH - 1], entry);
    
    if (load_history)
    	return;

    /* If not writable, just keeps the history around for this session */
    if (!g_settings_is_writable (mcdata->settings, KEY_HISTORY))
        return;
    	
    /* Save history - this seems like a waste to do it every time it's updated 
    ** but it doesn't seem to work when called on the destroy signal of the applet 
    */
    history = g_array_new (TRUE, TRUE, sizeof (gchar *));

    for (i = 0; i < MC_HISTORY_LIST_LENGTH; i++) {
	    if (exists_history_entry(i)) {
	        gchar *entry = g_strdup (get_history_entry (i));
	        history = g_array_append_val (history, entry);
        }
	}

    g_settings_set_strv (mcdata->settings, KEY_HISTORY, (const gchar **) history->data);

    g_array_free (history, TRUE);
}
Esempio n. 20
0
static void
set_autocheck_type (GSettings *settings,
		    PlumaSpellPluginAutocheckType autocheck_type)
{
	if (!g_settings_is_writable (settings,
				     AUTOCHECK_TYPE_KEY))
	{
		return;
	}

	g_settings_set_enum (settings,
			     AUTOCHECK_TYPE_KEY,
			     autocheck_type);
}
Esempio n. 21
0
static void
panel_properties_dialog_arrows_sensitivity_update (GSettings             *settings,
						   char                  *key,
						   PanelPropertiesDialog *dialog)
{
	gboolean sensitive;

	sensitive = (g_settings_get_boolean (settings,
					     PANEL_TOPLEVEL_ENABLE_BUTTONS_KEY) &&
		     g_settings_is_writable (settings,
					     PANEL_TOPLEVEL_ENABLE_ARROWS_KEY));

	gtk_widget_set_sensitive (dialog->arrows_toggle, sensitive);
}
Esempio n. 22
0
static void
visualization_quality_writable_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
	gboolean writable, show_visualizations;

	if (strcmp (key, "visualization-quality") != 0)
		return;

	writable = g_settings_is_writable (settings, key);
	show_visualizations = g_settings_get_boolean (settings, "show-visualizations");

	/* Only enable the size combobox if the visualization-quality setting is writable, and visualizations are enabled */
	gtk_widget_set_sensitive (PWID ("tpw_visuals_size_combobox"), writable && show_visualizations);
}
static void
wp_set_sensitivities (AppearanceData *data)
{
  MateWPItem *item;
  gchar *filename = NULL;

  item = get_selected_item (data, NULL);

  if (item != NULL)
    filename = item->filename;

  if (!g_settings_is_writable (data->wp_settings, WP_OPTIONS_KEY)
      || (filename && !strcmp (filename, "(none)")))
    gtk_widget_set_sensitive (data->wp_style_menu, FALSE);
  else
    gtk_widget_set_sensitive (data->wp_style_menu, TRUE);

  if (!g_settings_is_writable (data->wp_settings, WP_SHADING_KEY))
    gtk_widget_set_sensitive (data->wp_color_menu, FALSE);
  else
    gtk_widget_set_sensitive (data->wp_color_menu, TRUE);

  if (!g_settings_is_writable (data->wp_settings, WP_PCOLOR_KEY))
    gtk_widget_set_sensitive (data->wp_pcpicker, FALSE);
  else
    gtk_widget_set_sensitive (data->wp_pcpicker, TRUE);

  if (!g_settings_is_writable (data->wp_settings, WP_SCOLOR_KEY))
    gtk_widget_set_sensitive (data->wp_scpicker, FALSE);
  else
    gtk_widget_set_sensitive (data->wp_scpicker, TRUE);

  if (!filename || !strcmp (filename, "(none)"))
    gtk_widget_set_sensitive (data->wp_rem_button, FALSE);
  else
    gtk_widget_set_sensitive (data->wp_rem_button, TRUE);
}
Esempio n. 24
0
static void
menuitem_activated (GtkMenuItem *menuitem, charpick_data *curr_data)
{
	gchar *string;
	MatePanelApplet *applet = MATE_PANEL_APPLET (curr_data->applet);
	
	string = g_object_get_data (G_OBJECT (menuitem), "string");
	if (g_ascii_strcasecmp (curr_data->charlist, string) == 0)
		return;
	
	curr_data->charlist = string;
	build_table (curr_data);
	if (g_settings_is_writable (curr_data->settings, "current-list"))
		g_settings_set_string (curr_data->settings, "current-list", curr_data->charlist);
}
Esempio n. 25
0
static gboolean
set_background_color (PanelToplevel *toplevel,
		      guint16       *dropped)
{
	GSettings *settings;
	GdkRGBA    color;
	char      *color_str;

	if (!dropped)
		return FALSE;

	settings = get_settings_background_for_toplevel (toplevel);

	if (!g_settings_is_writable (settings,
				     PANEL_BACKGROUND_TYPE_KEY) ||
	    !g_settings_is_writable (settings,
				     PANEL_BACKGROUND_COLOR_KEY)) {
		g_object_unref (settings);
		return FALSE;
	}

	color.red   = dropped [0] / 65535.;
	color.green = dropped [1] / 65535.;
	color.blue  = dropped [2] / 65535.;
	color.alpha = 1.;

	color_str = gdk_rgba_to_string (&color);

	g_settings_set_string (settings, PANEL_BACKGROUND_COLOR_KEY, color_str);
	g_settings_set_enum (settings, PANEL_BACKGROUND_TYPE_KEY, PANEL_BACK_COLOR);

	g_free (color_str);
	g_object_unref (settings);

	return TRUE;
}
Esempio n. 26
0
void
launcher_load (PanelWidget *panel_widget,
	       const char  *id,
	       GSettings   *settings)
{
	GSettings *settings_instance;
	Launcher  *launcher;
	char      *launcher_location;

	g_return_if_fail (panel_widget != NULL);
	g_return_if_fail (id != NULL);

	settings_instance = panel_layout_get_instance_settings (settings,
								PANEL_LAUNCHER_SCHEMA);

	launcher_location = g_settings_get_string (settings_instance,
						   PANEL_LOCATION_KEY);

	if (PANEL_GLIB_STR_EMPTY (launcher_location)) {
		g_printerr (_("Launcher location is not set, cannot load launcher\n"));
		g_free (launcher_location);
		g_object_unref (settings_instance);
		return;
	}

	launcher = load_launcher_applet (launcher_location,
					 panel_widget,
					 id, settings);

	if (launcher) {
		if (!g_settings_is_writable (settings_instance,
					     PANEL_LOCATION_KEY)) {
			AppletUserMenu *menu;

			menu = panel_applet_get_callback (launcher->info->user_menu,
							  "properties");
			if (menu != NULL)
				menu->sensitive = FALSE;
		}
	}

	g_free (launcher_location);
	g_object_unref (settings_instance);
}
Esempio n. 27
0
static gboolean
reset_background (PanelToplevel *toplevel)
{
	GSettings *settings;

	settings = get_settings_background_for_toplevel (toplevel);

	if (!g_settings_is_writable (settings,
				     PANEL_BACKGROUND_TYPE_KEY)) {
		g_object_unref (settings);
		return FALSE;
	}

	g_settings_set_enum (settings, PANEL_BACKGROUND_TYPE_KEY, PANEL_BACK_NONE);

	g_object_unref (settings);

	return TRUE;
}
static int
config_get_mode (gboolean *is_writable)
{
	GSettings *settings;
	int          mode;

	settings = g_settings_new (GSETTINGS_SCHEMA);

	if (is_writable)
	{
		*is_writable = g_settings_is_writable (settings,
		               KEY_MODE);
	}

	mode = g_settings_get_enum (settings, KEY_MODE);

	g_object_unref (settings);

	return mode;
}
static gboolean
config_get_lock (gboolean *is_writable)
{
	GSettings *settings;
	gboolean     lock;

	settings = g_settings_new (GSETTINGS_SCHEMA);

	if (is_writable)
	{
		*is_writable = g_settings_is_writable (settings,
		               KEY_LOCK);
	}

	lock = g_settings_get_boolean (settings, KEY_LOCK);

	g_object_unref (settings);

	return lock;
}
static gboolean
config_get_enabled (gboolean *is_writable)
{
	int          enabled;
	GSettings *settings;

	settings = g_settings_new (GSETTINGS_SCHEMA);

	if (is_writable)
	{
		*is_writable = g_settings_is_writable (settings,
		               KEY_LOCK);
	}

	enabled = g_settings_get_boolean (settings, KEY_IDLE_ACTIVATION_ENABLED);

	g_object_unref (settings);

	return enabled;
}