Compare commits
3 Commits
3.29.2
...
startup-ap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14b83fce26 | ||
|
|
78ef46e3d2 | ||
|
|
c6f6184dcb |
@@ -91,6 +91,14 @@ typedef struct
|
||||
char **current;
|
||||
} VersionData;
|
||||
|
||||
enum {
|
||||
STARTUP_COL_ENABLED = 0,
|
||||
STARTUP_COL_GICON,
|
||||
STARTUP_COL_DESCRIPTION,
|
||||
STARTUP_COL_FILENAME,
|
||||
STARTUP_NUMBER_OF_COLUMNS
|
||||
};
|
||||
|
||||
static void
|
||||
version_start_element_handler (GMarkupParseContext *ctx,
|
||||
const char *element_name,
|
||||
@@ -1043,6 +1051,11 @@ info_panel_setup_selector (CcInfoPanel *self)
|
||||
_("Default Applications"),
|
||||
-1);
|
||||
|
||||
gtk_list_store_append (model, &iter);
|
||||
gtk_list_store_set (model, &iter, section_name_column,
|
||||
_("Startup Applications"),
|
||||
-1);
|
||||
|
||||
gtk_list_store_append (model, &iter);
|
||||
gtk_list_store_set (model, &iter, section_name_column,
|
||||
_("Graphics"),
|
||||
@@ -1241,6 +1254,125 @@ info_panel_setup_overview (CcInfoPanel *self)
|
||||
gtk_widget_reparent (widget, (GtkWidget *) self);
|
||||
}
|
||||
|
||||
static void
|
||||
populate_startup_model (GtkListStore *model)
|
||||
{
|
||||
gchar *path;
|
||||
const gchar *name;
|
||||
GDir *dir;
|
||||
|
||||
path = g_build_filename (g_get_user_config_dir (), "autostart", NULL);
|
||||
dir = g_dir_open (path, 0, NULL);
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
while ((name = g_dir_read_name (dir))) {
|
||||
gchar *file_path;
|
||||
GKeyFile *key_file;
|
||||
|
||||
if (!g_str_has_suffix (name, ".desktop"))
|
||||
continue;
|
||||
|
||||
file_path = g_build_filename (path, name, NULL);
|
||||
key_file = g_key_file_new ();
|
||||
if (g_key_file_load_from_file (key_file, file_path, G_KEY_FILE_NONE, NULL)) {
|
||||
gboolean is_hidden;
|
||||
GtkTreeIter new_row;
|
||||
gchar *icon_path, *description;
|
||||
GIcon *gicon;
|
||||
|
||||
/* If it's hidden, don't show it up */
|
||||
is_hidden = g_key_file_get_boolean (key_file, "Desktop Entry", G_KEY_FILE_DESKTOP_KEY_HIDDEN, NULL);
|
||||
//if (is_hidden)
|
||||
// continue;
|
||||
|
||||
/* Retrieve the icon for this entry */
|
||||
icon_path = g_key_file_get_locale_string (key_file, "Desktop Entry", G_KEY_FILE_DESKTOP_KEY_ICON, NULL, NULL);
|
||||
if (g_path_is_absolute (icon_path)) {
|
||||
GFile *icon_file;
|
||||
|
||||
icon_file = g_file_new_for_path (icon_path);
|
||||
gicon = g_file_icon_new (icon_file);
|
||||
|
||||
g_object_unref (icon_file);
|
||||
} else {
|
||||
gicon = g_themed_icon_new (icon_path);
|
||||
}
|
||||
|
||||
/* Set description */
|
||||
description = g_strdup_printf ("<b>%s</b>\n%s",
|
||||
g_key_file_get_locale_string (key_file, "Desktop Entry", G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL),
|
||||
g_key_file_get_locale_string (key_file, "Desktop Entry", G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL));
|
||||
|
||||
/* Add row to the model */
|
||||
gtk_list_store_append (model, &new_row);
|
||||
gtk_list_store_set (model, &new_row,
|
||||
0, g_key_file_get_boolean (key_file, "Desktop Entry", "X-GNOME-Autostart-enabled", NULL),
|
||||
1, gicon,
|
||||
2, description,
|
||||
3, key_file,
|
||||
-1);
|
||||
|
||||
g_free (icon_path);
|
||||
} else
|
||||
g_key_file_free (key_file);
|
||||
|
||||
g_free (file_path);
|
||||
}
|
||||
|
||||
g_dir_close (dir);
|
||||
}
|
||||
|
||||
static void
|
||||
info_panel_setup_startup_apps (CcInfoPanel *self)
|
||||
{
|
||||
GtkListStore *model;
|
||||
GtkWidget *treeview;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeViewColumn *column;
|
||||
|
||||
/* Create the model and setup treeview */
|
||||
model = gtk_list_store_new (STARTUP_NUMBER_OF_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_ICON, G_TYPE_STRING, G_TYPE_POINTER);
|
||||
|
||||
treeview = WID ("startup_apps_treeview");
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (model));
|
||||
g_object_unref (model);
|
||||
|
||||
/* ...Enable/disable column */
|
||||
renderer = gtk_cell_renderer_toggle_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes (_("Enabled"),
|
||||
renderer,
|
||||
"active", STARTUP_COL_ENABLED,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
|
||||
|
||||
/* ...Icon column */
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes (_("Icon"),
|
||||
renderer,
|
||||
"gicon", STARTUP_COL_GICON,
|
||||
"sensitive", STARTUP_COL_ENABLED,
|
||||
NULL);
|
||||
g_object_set (renderer,
|
||||
"stock-size", GTK_ICON_SIZE_LARGE_TOOLBAR,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
|
||||
|
||||
/* ...Description column */
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes (_("Description"),
|
||||
renderer,
|
||||
"markup", STARTUP_COL_DESCRIPTION,
|
||||
"sensitive", STARTUP_COL_ENABLED,
|
||||
NULL);
|
||||
g_object_set (renderer,
|
||||
"ellipsize", PANGO_ELLIPSIZE_END,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
|
||||
|
||||
populate_startup_model (model);
|
||||
}
|
||||
|
||||
static void
|
||||
refresh_update_button (CcInfoPanel *self)
|
||||
{
|
||||
@@ -1443,6 +1575,7 @@ cc_info_panel_init (CcInfoPanel *self)
|
||||
info_panel_setup_overview (self);
|
||||
info_panel_setup_default_apps (self);
|
||||
info_panel_setup_graphics (self);
|
||||
info_panel_setup_startup_apps (self);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -99,9 +99,6 @@
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Device name</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -110,9 +107,6 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Memory</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
@@ -125,9 +119,6 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Processor</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
@@ -140,9 +131,6 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">OS type</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
@@ -155,9 +143,6 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Disk</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">5</property>
|
||||
@@ -166,10 +151,8 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="name_entry">
|
||||
<property name="visible">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="text"></property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
@@ -310,9 +293,6 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Graphics</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
@@ -613,6 +593,12 @@
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="graphics_detail_container">
|
||||
<property name="visible">True</property>
|
||||
@@ -632,9 +618,6 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Driver</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
@@ -647,9 +630,6 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Experience</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
@@ -666,9 +646,6 @@
|
||||
<property name="label" translatable="yes" comments="Hardware is not able to run GNOME 3's shell, so we might want to force running the 'Fallback' experience.">Forced _Fallback Mode</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">right</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
@@ -762,7 +739,7 @@
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
@@ -771,8 +748,138 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Graphics</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTable" id="startup_apps_container">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_columns">3</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<property name="row_spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Additional startup programs</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVButtonBox" id="vbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">3</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="layout_style">start</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="add_startup_button">
|
||||
<property name="label">gtk-add</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="remove_startup_button">
|
||||
<property name="label">gtk-delete</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="edit_startup_button">
|
||||
<property name="label">gtk-edit</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="startup_apps_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="headers_clickable">False</property>
|
||||
<property name="enable_search">False</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection2"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label18">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">page 5</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">4</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
Reference in New Issue
Block a user