[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add terminal_window_attr_new()
noreply at xfce.org
noreply at xfce.org
Sun Jun 3 19:46:54 CEST 2018
This is an automated email from the git hooks/post-receive script.
f 2 4 0 4 p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-terminal.
commit ecec2f1e763ca2701923c845a44f06119630953a
Author: Igor <f2404 at yandex.ru>
Date: Sun Jun 3 13:46:47 2018 -0400
Add terminal_window_attr_new()
---
terminal/main.c | 4 +--
terminal/terminal-options.c | 33 +++++++++++++--------
terminal/terminal-options.h | 70 +++++++++++++++++++++++----------------------
terminal/terminal-window.c | 3 +-
4 files changed, 60 insertions(+), 50 deletions(-)
diff --git a/terminal/main.c b/terminal/main.c
index 31f2552..772d9b0 100644
--- a/terminal/main.c
+++ b/terminal/main.c
@@ -182,7 +182,7 @@ main (int argc, char **argv)
/* initialize options */
options.disable_server = options.show_version = options.show_colors = options.show_help =
- options.show_preferences = FALSE;
+ options.show_preferences = 0;
/* install required signal handlers */
signal (SIGPIPE, SIG_IGN);
@@ -284,7 +284,7 @@ main (int argc, char **argv)
|| g_error_matches (error, TERMINAL_ERROR, TERMINAL_ERROR_DISPLAY_MISMATCH))
{
/* don't try to establish another service here */
- options.disable_server = TRUE;
+ options.disable_server = 1;
#ifdef G_ENABLE_DEBUG
g_debug ("%s mismatch when invoking remote terminal: %s",
diff --git a/terminal/terminal-options.c b/terminal/terminal-options.c
index 21b72c9..6ab09ad 100644
--- a/terminal/terminal-options.c
+++ b/terminal/terminal-options.c
@@ -146,15 +146,15 @@ terminal_options_parse (gint argc,
break;
if (terminal_option_cmp ("help", 'h', argc, argv, &n, NULL))
- options->show_help = TRUE;
+ options->show_help = 1;
else if (terminal_option_cmp ("version", 'V', argc, argv, &n, NULL))
- options->show_version = TRUE;
+ options->show_version = 1;
else if (terminal_option_cmp ("disable-server", 0, argc, argv, &n, NULL))
- options->disable_server = TRUE;
+ options->disable_server = 1;
else if (terminal_option_cmp ("color-table", 0, argc, argv, &n, NULL))
- options->show_colors = TRUE;
+ options->show_colors = 1;
else if (terminal_option_cmp ("preferences", 0, argc, argv, &n, NULL))
- options->show_preferences = TRUE;
+ options->show_preferences = 1;
}
}
@@ -511,7 +511,7 @@ terminal_window_attr_parse (gint argc,
else
{
/* add new tab */
- tab_attr = g_slice_new0 (TerminalTabAttr);
+ tab_attr = terminal_tab_attr_new ();
win_attr->tabs = g_slist_append (win_attr->tabs, tab_attr);
}
}
@@ -620,23 +620,32 @@ failed:
TerminalWindowAttr*
terminal_window_attr_new (void)
{
- TerminalWindowAttr *win_attr;
- TerminalTabAttr *tab_attr;
+ TerminalWindowAttr *win_attr = g_slice_new0 (TerminalWindowAttr);
- win_attr = g_slice_new0 (TerminalWindowAttr);
win_attr->fullscreen = FALSE;
win_attr->menubar = TERMINAL_VISIBILITY_DEFAULT;
win_attr->borders = TERMINAL_VISIBILITY_DEFAULT;
win_attr->toolbar = TERMINAL_VISIBILITY_DEFAULT;
win_attr->scrollbar = TERMINAL_VISIBILITY_DEFAULT;
win_attr->zoom = TERMINAL_ZOOM_LEVEL_DEFAULT;
+ win_attr->tabs = g_slist_prepend (NULL, terminal_tab_attr_new ());
+
+ return win_attr;
+}
+
+
+
+/**
+ **/
+TerminalTabAttr*
+terminal_tab_attr_new (void)
+{
+ TerminalTabAttr *tab_attr = g_slice_new0 (TerminalTabAttr);
- tab_attr = g_slice_new0 (TerminalTabAttr);
tab_attr->dynamic_title_mode = TERMINAL_TITLE_DEFAULT;
tab_attr->position = -1;
- win_attr->tabs = g_slist_prepend (NULL, tab_attr);
- return win_attr;
+ return tab_attr;
}
diff --git a/terminal/terminal-options.h b/terminal/terminal-options.h
index b227474..c587ed5 100644
--- a/terminal/terminal-options.h
+++ b/terminal/terminal-options.h
@@ -54,48 +54,48 @@ typedef enum
typedef struct
{
- gchar **command;
- gchar *directory;
- gchar *title;
- gchar *initial_title;
- gchar *color_text;
- gchar *color_bg;
- gchar *color_title;
- TerminalTitle dynamic_title_mode;
- gint position;
- guint hold : 1;
- guint active : 1;
+ gchar **command;
+ gchar *directory;
+ gchar *title;
+ gchar *initial_title;
+ gchar *color_text;
+ gchar *color_bg;
+ gchar *color_title;
+ TerminalTitle dynamic_title_mode;
+ gint position;
+ guint hold : 1;
+ guint active : 1;
} TerminalTabAttr;
typedef struct
{
- GSList *tabs;
- gchar *display;
- gchar *geometry;
- gchar *role;
- gchar *startup_id;
- gchar *sm_client_id;
- gchar *icon;
- gchar *font;
- guint drop_down : 1;
- guint fullscreen : 1;
- guint maximize : 1;
- guint minimize : 1;
- guint reuse_last_window : 1;
- TerminalVisibility menubar;
- TerminalVisibility borders;
- TerminalVisibility toolbar;
- TerminalVisibility scrollbar;
- TerminalZoomLevel zoom;
+ GSList *tabs;
+ gchar *display;
+ gchar *geometry;
+ gchar *role;
+ gchar *startup_id;
+ gchar *sm_client_id;
+ gchar *icon;
+ gchar *font;
+ guint drop_down : 1;
+ guint fullscreen : 1;
+ guint maximize : 1;
+ guint minimize : 1;
+ guint reuse_last_window : 1;
+ TerminalVisibility menubar;
+ TerminalVisibility borders;
+ TerminalVisibility toolbar;
+ TerminalVisibility scrollbar;
+ TerminalZoomLevel zoom;
} TerminalWindowAttr;
typedef struct
{
- gboolean show_help;
- gboolean show_version;
- gboolean show_colors;
- gboolean show_preferences;
- gboolean disable_server;
+ guint show_help : 1;
+ guint show_version : 1;
+ guint show_colors : 1;
+ guint show_preferences : 1;
+ guint disable_server : 1;
} TerminalOptions;
void terminal_options_parse (gint argc,
@@ -109,6 +109,8 @@ GSList *terminal_window_attr_parse (gint argc,
TerminalWindowAttr *terminal_window_attr_new (void);
+TerminalTabAttr *terminal_tab_attr_new (void);
+
void terminal_tab_attr_free (TerminalTabAttr *attr);
void terminal_window_attr_free (TerminalWindowAttr *attr);
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index 868191a..6f242a9 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -1105,9 +1105,8 @@ terminal_window_close_tab_request (TerminalScreen *screen,
GtkNotebook *notebook = GTK_NOTEBOOK (window->priv->notebook);
/* store attrs of the tab being closed */
- TerminalTabAttr *tab_attr = g_slice_new0 (TerminalTabAttr);
+ TerminalTabAttr *tab_attr = terminal_tab_attr_new ();
tab_attr->active = (screen == window->priv->active);
- tab_attr->dynamic_title_mode = TERMINAL_TITLE_DEFAULT;
tab_attr->position = gtk_notebook_page_num (notebook, GTK_WIDGET (screen));
tab_attr->directory = g_strdup (terminal_screen_get_working_directory (screen));
tab_attr->title = IS_STRING (terminal_screen_get_custom_title (screen)) ?
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list