summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/terminal-app.c8
-rw-r--r--src/terminal-app.h1
-rw-r--r--src/terminal-options.c45
-rw-r--r--src/terminal-options.h2
4 files changed, 48 insertions, 8 deletions
diff --git a/src/terminal-app.c b/src/terminal-app.c
index d54da49..48f8b0b 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -1797,6 +1797,14 @@ terminal_app_handle_options (TerminalApp *app,
if (iw->role)
gtk_window_set_role (GTK_WINDOW (window), iw->role);
+ if (iw->icon)
+ {
+ if (g_path_is_absolute (iw->icon))
+ gtk_window_set_icon_from_file (GTK_WINDOW (window), iw->icon, NULL);
+ else
+ gtk_window_set_icon_name (GTK_WINDOW (window), iw->icon);
+ }
+
if (iw->force_menubar_state)
terminal_window_set_menubar_visible (window, iw->menubar_state);
diff --git a/src/terminal-app.h b/src/terminal-app.h
index aeaca4c..ebb78c1 100644
--- a/src/terminal-app.h
+++ b/src/terminal-app.h
@@ -43,6 +43,7 @@ G_BEGIN_DECLS
#define TERMINAL_CONFIG_WINDOW_PROP_ACTIVE_TAB "ActiveTerminal"
#define TERMINAL_CONFIG_WINDOW_PROP_FULLSCREEN "Fullscreen"
#define TERMINAL_CONFIG_WINDOW_PROP_GEOMETRY "Geometry"
+#define TERMINAL_CONFIG_WINDOW_PROP_ICON "Icon"
#define TERMINAL_CONFIG_WINDOW_PROP_MAXIMIZED "Maximized"
#define TERMINAL_CONFIG_WINDOW_PROP_MENUBAR_VISIBLE "MenubarVisible"
#define TERMINAL_CONFIG_WINDOW_PROP_ROLE "Role"
diff --git a/src/terminal-options.c b/src/terminal-options.c
index 352466f..ab24d4a 100644
--- a/src/terminal-options.c
+++ b/src/terminal-options.c
@@ -85,6 +85,7 @@ initial_window_free (InitialWindow *iw)
g_list_free (iw->tabs);
g_free (iw->geometry);
g_free (iw->role);
+ g_free (iw->icon);
g_slice_free (InitialWindow, iw);
}
@@ -101,6 +102,9 @@ apply_defaults (TerminalOptions *options,
if (iw->geometry == NULL)
iw->geometry = g_strdup (options->default_geometry);
+ if (iw->icon == NULL)
+ iw->icon = g_strdup (options->default_icon);
+
if (options->default_window_menubar_forced)
{
iw->force_menubar_state = TRUE;
@@ -478,6 +482,27 @@ option_geometry_callback (const gchar *option_name,
}
static gboolean
+option_icon_callback (const gchar *option_name,
+ const gchar *value,
+ gpointer data,
+ GError **error)
+{
+ TerminalOptions *options = data;
+
+ if (options->initial_windows)
+ {
+ InitialWindow *iw;
+
+ iw = g_list_last (options->initial_windows)->data;
+ iw->icon = g_strdup (value);
+ }
+ else
+ options->default_icon = g_strdup (value);
+
+ return TRUE;
+}
+
+static gboolean
option_disable_factory_callback (const gchar *option_name,
const gchar *value,
gpointer data,
@@ -719,6 +744,7 @@ terminal_options_parse (const char *working_directory,
options->initial_windows = NULL;
options->default_role = NULL;
options->default_geometry = NULL;
+ options->default_icon = NULL;
options->default_title = NULL;
options->zoom = 1.0;
@@ -846,6 +872,7 @@ terminal_options_merge_config (TerminalOptions *options,
iw->role = g_key_file_get_string (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_ROLE, NULL);
iw->geometry = g_key_file_get_string (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_GEOMETRY, NULL);
+ iw->icon = g_key_file_get_string (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_ICON, NULL);
iw->start_fullscreen = g_key_file_get_boolean (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_FULLSCREEN, NULL);
iw->start_maximized = g_key_file_get_boolean (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_MAXIMIZED, NULL);
if (g_key_file_has_key (key_file, window_group, TERMINAL_CONFIG_WINDOW_PROP_MENUBAR_VISIBLE, NULL))
@@ -926,6 +953,7 @@ terminal_options_free (TerminalOptions *options)
g_strfreev (options->env);
g_free (options->default_role);
g_free (options->default_geometry);
+ g_free (options->default_icon);
g_free (options->default_working_dir);
g_free (options->default_title);
g_free (options->default_profile);
@@ -1054,6 +1082,15 @@ get_goption_context (TerminalOptions *options)
N_("ROLE")
},
{
+ "icon",
+ 0,
+ 0,
+ G_OPTION_ARG_CALLBACK,
+ option_icon_callback,
+ N_("Set the window icon"),
+ N_("ICON")
+ },
+ {
"active",
0,
G_OPTION_FLAG_NO_ARG,
@@ -1330,14 +1367,6 @@ get_goption_context (TerminalOptions *options)
NULL, NULL
},
{
- "icon",
- 0,
- G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
- G_OPTION_ARG_CALLBACK,
- unsupported_option_callback,
- NULL, NULL
- },
- {
"termname",
0,
G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_NO_ARG,
diff --git a/src/terminal-options.h b/src/terminal-options.h
index 50d8224..877aba4 100644
--- a/src/terminal-options.h
+++ b/src/terminal-options.h
@@ -40,6 +40,7 @@ typedef struct
gboolean default_maximize;
char *default_role;
char *default_geometry;
+ char *default_icon;
char *default_working_dir;
char *default_title;
char **exec_argv;
@@ -83,6 +84,7 @@ typedef struct
char *geometry;
char *role;
+ char *icon;
} InitialWindow;