aplicando formato allman

master-1.22
Perberos 2011-11-06 19:14:03 -03:00
parent def492f92d
commit f2a13175e5
48 changed files with 14188 additions and 13836 deletions

View File

@ -34,7 +34,8 @@
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
struct EggDesktopFile {
struct EggDesktopFile
{
GKeyFile *key_file;
char *source;
@ -989,7 +990,8 @@ end_startup_notification (GdkDisplay *display,
#define EGG_DESKTOP_FILE_SN_TIMEOUT_LENGTH (30 /* seconds */)
typedef struct {
typedef struct
{
GdkDisplay *display;
char *startup_id;
} StartupNotificationData;
@ -1428,7 +1430,8 @@ egg_set_desktop_file_internal (const char *desktop_file_path,
g_error_free (error);
}
if (set_defaults && egg_desktop_file != NULL) {
if (set_defaults && egg_desktop_file != NULL)
{
/* Set localized application name and default window icon */
if (egg_desktop_file->name)
g_set_application_name (egg_desktop_file->name);

View File

@ -26,7 +26,8 @@ G_BEGIN_DECLS
typedef struct EggDesktopFile EggDesktopFile;
typedef enum {
typedef enum
{
EGG_DESKTOP_FILE_TYPE_UNRECOGNIZED,
EGG_DESKTOP_FILE_TYPE_APPLICATION,
@ -71,7 +72,8 @@ gboolean egg_desktop_file_launch (EggDesktopFile *deskto
GError **error,
...) G_GNUC_NULL_TERMINATED;
typedef enum {
typedef enum
{
EGG_DESKTOP_FILE_LAUNCH_CLEARENV = 1,
EGG_DESKTOP_FILE_LAUNCH_PUTENV,
EGG_DESKTOP_FILE_LAUNCH_SCREEN,
@ -143,7 +145,8 @@ char **egg_desktop_file_get_locale_string_list (EggDesktopFile *desktop_file
GQuark egg_desktop_file_error_quark (void);
typedef enum {
typedef enum
{
EGG_DESKTOP_FILE_ERROR_INVALID,
EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
EGG_DESKTOP_FILE_ERROR_UNRECOGNIZED_OPTION

View File

@ -60,7 +60,8 @@ egg_shell (const char *shell)
#ifndef G_OS_WIN32
struct passwd *pw;
int i;
static const char shells [][14] = {
static const char shells [][14] =
{
/* Note that on some systems shells can also
* be installed in /usr/bin */
"/bin/bash", "/usr/bin/bash",
@ -71,23 +72,30 @@ egg_shell (const char *shell)
};
if (geteuid () == getuid () &&
getegid () == getgid ()) {
getegid () == getgid ())
{
/* only in non-setuid */
if (shell != NULL) {
if (access (shell, X_OK) == 0) {
if (shell != NULL)
{
if (access (shell, X_OK) == 0)
{
return g_strdup (shell);
}
}
}
pw = getpwuid(getuid());
if (pw && pw->pw_shell) {
if (access (pw->pw_shell, X_OK) == 0) {
if (pw && pw->pw_shell)
{
if (access (pw->pw_shell, X_OK) == 0)
{
return g_strdup (pw->pw_shell);
}
}
for (i = 0; i != G_N_ELEMENTS (shells); i++) {
if (access (shells [i], X_OK) == 0) {
for (i = 0; i != G_N_ELEMENTS (shells); i++)
{
if (access (shells [i], X_OK) == 0)
{
return g_strdup (shells[i]);
}
}

View File

@ -51,7 +51,8 @@
typedef struct _EggSMClientOSX EggSMClientOSX;
typedef struct _EggSMClientOSXClass EggSMClientOSXClass;
struct _EggSMClientOSX {
struct _EggSMClientOSX
{
EggSMClient parent;
AppleEvent quit_event, quit_reply;

View File

@ -66,7 +66,8 @@
typedef struct _EggSMClientWin32 EggSMClientWin32;
typedef struct _EggSMClientWin32Class EggSMClientWin32Class;
struct _EggSMClientWin32 {
struct _EggSMClientWin32
{
EggSMClient parent;
HANDLE message_event, response_event;
@ -224,7 +225,8 @@ got_message (gpointer smclient)
/* Windows HANDLE GSource */
typedef struct {
typedef struct
{
GSource source;
GPollFD pollfd;
} GWin32HandleSource;
@ -256,7 +258,8 @@ g_win32_handle_source_finalize (GSource *source)
;
}
GSourceFuncs g_win32_handle_source_funcs = {
GSourceFuncs g_win32_handle_source_funcs =
{
g_win32_handle_source_prepare,
g_win32_handle_source_check,
g_win32_handle_source_dispatch,

View File

@ -65,7 +65,8 @@ typedef enum
XSMP_STATE_CONNECTION_CLOSED
} EggSMClientXSMPState;
static const char *state_names[] = {
static const char *state_names[] =
{
"idle",
"save-yourself",
"interact-request",

View File

@ -30,7 +30,8 @@ static void egg_sm_client_debug_handler (const char *log_domain,
const char *message,
gpointer user_data);
enum {
enum
{
SAVE_STATE,
QUIT_REQUESTED,
QUIT_CANCELLED,
@ -40,7 +41,8 @@ enum {
static guint signals[LAST_SIGNAL];
struct _EggSMClientPrivate {
struct _EggSMClientPrivate
{
GKeyFile *state_file;
};
@ -219,27 +221,38 @@ sm_client_post_parse_func (GOptionContext *context,
GOptionGroup *
egg_sm_client_get_option_group (void)
{
const GOptionEntry entries[] = {
{ "sm-client-disable", 0, 0,
const GOptionEntry entries[] =
{
{
"sm-client-disable", 0, 0,
G_OPTION_ARG_NONE, &sm_client_disable,
N_("Disable connection to session manager"), NULL },
{ "sm-client-state-file", 0, 0,
N_("Disable connection to session manager"), NULL
},
{
"sm-client-state-file", 0, 0,
G_OPTION_ARG_FILENAME, &sm_client_state_file,
N_("Specify file containing saved configuration"), N_("FILE") },
{ "sm-client-id", 0, 0,
N_("Specify file containing saved configuration"), N_("FILE")
},
{
"sm-client-id", 0, 0,
G_OPTION_ARG_STRING, &sm_client_id,
N_("Specify session management ID"), N_("ID") },
N_("Specify session management ID"), N_("ID")
},
/* MateClient compatibility option */
{ "sm-disable", 0, G_OPTION_FLAG_HIDDEN,
{
"sm-disable", 0, G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_NONE, &sm_client_disable,
NULL, NULL },
NULL, NULL
},
/* MateClient compatibility option. This is a dummy option that only
* exists so that sessions saved by apps with MateClient can be restored
* later when they've switched to EggSMClient. See bug #575308.
*/
{ "sm-config-prefix", 0, G_OPTION_FLAG_HIDDEN,
{
"sm-config-prefix", 0, G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_STRING, &sm_config_prefix,
NULL, NULL },
NULL, NULL
},
{ NULL }
};
GOptionGroup *group;

View File

@ -35,14 +35,16 @@ typedef struct _EggSMClient EggSMClient;
typedef struct _EggSMClientClass EggSMClientClass;
typedef struct _EggSMClientPrivate EggSMClientPrivate;
typedef enum {
typedef enum
{
EGG_SM_CLIENT_END_SESSION_DEFAULT,
EGG_SM_CLIENT_LOGOUT,
EGG_SM_CLIENT_REBOOT,
EGG_SM_CLIENT_SHUTDOWN
} EggSMClientEndStyle;
typedef enum {
typedef enum
{
EGG_SM_CLIENT_MODE_DISABLED,
EGG_SM_CLIENT_MODE_NO_RESTART,
EGG_SM_CLIENT_MODE_NORMAL

View File

@ -38,17 +38,28 @@ struct _TerminalColorScheme
const GdkColor background;
};
static const TerminalColorScheme color_schemes[] = {
{ N_("Black on light yellow"),
{ 0, 0x0000, 0x0000, 0x0000 }, { 0, 0xFFFF, 0xFFFF, 0xDDDD } },
{ N_("Black on white"),
{ 0, 0x0000, 0x0000, 0x0000 }, { 0, 0xFFFF, 0xFFFF, 0xFFFF } },
{ N_("Gray on black"),
{ 0, 0xAAAA, 0xAAAA, 0xAAAA }, { 0, 0x0000, 0x0000, 0x0000 } },
{ N_("Green on black"),
{ 0, 0x0000, 0xFFFF, 0x0000 }, { 0, 0x0000, 0x0000, 0x0000 } },
{ N_("White on black"),
{ 0, 0xFFFF, 0xFFFF, 0xFFFF }, { 0, 0x0000, 0x0000, 0x0000 } }
static const TerminalColorScheme color_schemes[] =
{
{
N_("Black on light yellow"),
{ 0, 0x0000, 0x0000, 0x0000 }, { 0, 0xFFFF, 0xFFFF, 0xDDDD }
},
{
N_("Black on white"),
{ 0, 0x0000, 0x0000, 0x0000 }, { 0, 0xFFFF, 0xFFFF, 0xFFFF }
},
{
N_("Gray on black"),
{ 0, 0xAAAA, 0xAAAA, 0xAAAA }, { 0, 0x0000, 0x0000, 0x0000 }
},
{
N_("Green on black"),
{ 0, 0x0000, 0xFFFF, 0x0000 }, { 0, 0x0000, 0x0000, 0x0000 }
},
{
N_("White on black"),
{ 0, 0xFFFF, 0xFFFF, 0xFFFF }, { 0, 0x0000, 0x0000, 0x0000 }
}
};
static void profile_forgotten_cb (TerminalProfile *profile,
@ -599,18 +610,21 @@ update_image_preview (GtkFileChooser *chooser)
image = gtk_file_chooser_get_preview_widget (GTK_FILE_CHOOSER (chooser));
file = gtk_file_chooser_get_preview_uri (chooser);
if (file != NULL) {
if (file != NULL)
{
GdkPixbuf *pixbuf = NULL;
pixbuf = create_preview_pixbuf (file);
g_free (file);
if (pixbuf != NULL) {
if (pixbuf != NULL)
{
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
g_object_unref (pixbuf);
}
else {
else
{
gtk_image_set_from_stock (GTK_IMAGE (image),
"gtk-dialog-question",
GTK_ICON_SIZE_DIALOG);
@ -709,7 +723,8 @@ terminal_profile_editor_focus_widget (GtkWidget *editor,
page = page_parent;
page_parent = gtk_widget_get_parent (page);
if (page != NULL && GTK_IS_NOTEBOOK (page_parent)) {
if (page != NULL && GTK_IS_NOTEBOOK (page_parent))
{
GtkNotebook *notebook;
notebook = GTK_NOTEBOOK (page_parent);
@ -754,7 +769,8 @@ terminal_profile_edit (TerminalProfile *profile,
path = g_build_filename (TERM_PKGDATADIR, "profile-preferences.ui", NULL);
builder = gtk_builder_new ();
if (!gtk_builder_add_from_file (builder, path, &error)) {
if (!gtk_builder_add_from_file (builder, path, &error))
{
g_warning ("Failed to load %s: %s\n", path, error->message);
g_error_free (error);
g_free (path);

View File

@ -30,7 +30,8 @@
#define SKEY_PREFIX "s/key "
#define OTP_PREFIX "otp-"
typedef struct {
typedef struct
{
TerminalScreen *screen;
char *seed;
int seq;

View File

@ -42,12 +42,14 @@ static void byteReverse(unsigned char *buf, unsigned longs);
static void byteReverse(unsigned char *buf, unsigned longs)
{
guint32 t;
do {
do
{
t = (guint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
*(guint32 *) buf = t;
buf += 4;
} while (--longs);
}
while (--longs);
}
#endif
@ -88,11 +90,13 @@ void MD4Update(MD4_CTX *ctx, unsigned char const *buf,
/* Handle any leading odd-sized chunks */
if (t) {
if (t)
{
unsigned char *p = (unsigned char *) ctx->in + t;
t = 64 - t;
if (len < t) {
if (len < t)
{
memcpy(p, buf, len);
return;
}
@ -104,7 +108,8 @@ void MD4Update(MD4_CTX *ctx, unsigned char const *buf,
}
/* Process data in 64-byte chunks */
while (len >= 64) {
while (len >= 64)
{
memcpy(ctx->in, buf, 64);
byteReverse(ctx->in, 16);
MD4Transform(ctx->buf, (guint32 *) ctx->in);
@ -138,7 +143,8 @@ void MD4Final(unsigned char* digest, MD4_CTX *ctx)
count = 64 - 1 - count;
/* Pad out to 56 mod 64 */
if (count < 8) {
if (count < 8)
{
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
byteReverse(ctx->in, 16);
@ -146,7 +152,9 @@ void MD4Final(unsigned char* digest, MD4_CTX *ctx)
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
} else {
}
else
{
/* Pad block to 56 bytes */
memset(p, 0, count - 8);
}
@ -317,10 +325,12 @@ int main(int argc, char *argv[])
md4 = (MD4_CTX *)malloc(sizeof(MD4_CTX));
MD4Init(md4);
do {
do
{
r = read(0, data, sizeof data);
MD4Update(md4, data, r);
} while (r);
}
while (r);
MD4Final(digest, md4);
printf("MD4 Digest is: ");

View File

@ -3,7 +3,8 @@
#include <glib.h>
typedef struct {
typedef struct
{
guint32 buf[4];
guint32 bits[2];
unsigned char in[64];

View File

@ -28,12 +28,14 @@
static void byteReverse(unsigned char *buf, unsigned longs)
{
guint32 t;
do {
do
{
t = (guint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
*(guint32 *) buf = t;
buf += 4;
} while (--longs);
}
while (--longs);
}
#endif

View File

@ -11,11 +11,13 @@
#include "skey.h"
#include "btoe.h"
struct skey_hash {
struct skey_hash
{
int (*Keycrunch) (char *, const char *, const char *);
void (*Skey) (char *);
};
static struct skey_hash hash_table[] = {
static struct skey_hash hash_table[] =
{
{ MD4Keycrunch, MD4SKey },
{ MD5Keycrunch, MD5SKey },
{ SHA1Keycrunch, SHA1SKey }

View File

@ -1,4 +1,5 @@
typedef enum {
typedef enum
{
MD4,
MD5,
SHA1

View File

@ -8,7 +8,8 @@
#include "skey.h"
typedef struct {
typedef struct
{
SKeyAlgorithm algorithm;
const char *passphrase;
const char *seed;
@ -17,7 +18,8 @@ typedef struct {
const char *btoe;
} TestEntry;
static const TestEntry tests[] = {
static const TestEntry tests[] =
{
{ MD4, "This is a test.", "TeSt", 0, "D185 4218 EBBB 0B51", "ROME MUG FRED SCAN LIVE LACE" },
{ MD4, "This is a test.", "TeSt", 1, "6347 3EF0 1CD0 B444", "CARD SAD MINI RYE COL KIN" },
{ MD4, "This is a test.", "TeSt", 99, "C5E6 1277 6E6C 237A", "NOTE OUT IBIS SINK NAVE MODE" },
@ -49,7 +51,8 @@ static const TestEntry tests[] = {
{ SHA1, "Passphrase", "IiIi", 100, "27F4 01CC 0AC8 5112", "MEG JACK DIET GAD FORK GARY" }
};
static const char *algos[] = {
static const char *algos[] =
{
"MD4",
"MD5",
"SHA1"
@ -80,7 +83,8 @@ int main(int argc, char *argv[])
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.mate.org/enter_bug.cgi?product=mate-terminal");
for (i = 0; i < G_N_ELEMENTS (tests); ++i) {
for (i = 0; i < G_N_ELEMENTS (tests); ++i)
{
const TestEntry *test = &tests[i];
char *name;

View File

@ -132,105 +132,172 @@ typedef struct
static KeyEntry file_entries[] =
{
{ N_("New Tab"),
KEY_NEW_TAB, ACCEL_PATH_NEW_TAB, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_t, NULL, FALSE, TRUE },
{ N_("New Window"),
KEY_NEW_WINDOW, ACCEL_PATH_NEW_WINDOW, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_n, NULL, FALSE, TRUE },
{ N_("New Profile"),
KEY_NEW_PROFILE, ACCEL_PATH_NEW_PROFILE, 0, 0, NULL, FALSE, TRUE },
{
N_("New Tab"),
KEY_NEW_TAB, ACCEL_PATH_NEW_TAB, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_t, NULL, FALSE, TRUE
},
{
N_("New Window"),
KEY_NEW_WINDOW, ACCEL_PATH_NEW_WINDOW, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_n, NULL, FALSE, TRUE
},
{
N_("New Profile"),
KEY_NEW_PROFILE, ACCEL_PATH_NEW_PROFILE, 0, 0, NULL, FALSE, TRUE
},
#ifdef ENABLE_SAVE
{ N_("Save Contents"),
KEY_SAVE_CONTENTS, ACCEL_PATH_SAVE_CONTENTS, 0, 0, NULL, FALSE, TRUE },
{
N_("Save Contents"),
KEY_SAVE_CONTENTS, ACCEL_PATH_SAVE_CONTENTS, 0, 0, NULL, FALSE, TRUE
},
#endif
{ N_("Close Tab"),
KEY_CLOSE_TAB, ACCEL_PATH_CLOSE_TAB, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_w, NULL, FALSE, TRUE },
{ N_("Close Window"),
KEY_CLOSE_WINDOW, ACCEL_PATH_CLOSE_WINDOW, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_q, NULL, FALSE, TRUE },
{
N_("Close Tab"),
KEY_CLOSE_TAB, ACCEL_PATH_CLOSE_TAB, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_w, NULL, FALSE, TRUE
},
{
N_("Close Window"),
KEY_CLOSE_WINDOW, ACCEL_PATH_CLOSE_WINDOW, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_q, NULL, FALSE, TRUE
},
};
static KeyEntry edit_entries[] =
{
{ N_("Copy"),
KEY_COPY, ACCEL_PATH_COPY, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_c, NULL, FALSE, TRUE },
{ N_("Paste"),
KEY_PASTE, ACCEL_PATH_PASTE, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_v, NULL, FALSE, TRUE },
{
N_("Copy"),
KEY_COPY, ACCEL_PATH_COPY, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_c, NULL, FALSE, TRUE
},
{
N_("Paste"),
KEY_PASTE, ACCEL_PATH_PASTE, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_v, NULL, FALSE, TRUE
},
};
static KeyEntry view_entries[] =
{
{ N_("Hide and Show menubar"),
KEY_TOGGLE_MENUBAR, ACCEL_PATH_TOGGLE_MENUBAR, 0, 0, NULL, FALSE, TRUE },
{ N_("Full Screen"),
KEY_FULL_SCREEN, ACCEL_PATH_FULL_SCREEN, 0, GDK_F11, NULL, FALSE, TRUE },
{ N_("Zoom In"),
KEY_ZOOM_IN, ACCEL_PATH_ZOOM_IN, GDK_CONTROL_MASK, GDK_plus, NULL, FALSE, TRUE },
{ N_("Zoom Out"),
KEY_ZOOM_OUT, ACCEL_PATH_ZOOM_OUT, GDK_CONTROL_MASK, GDK_minus, NULL, FALSE, TRUE },
{ N_("Normal Size"),
KEY_ZOOM_NORMAL, ACCEL_PATH_ZOOM_NORMAL, GDK_CONTROL_MASK, GDK_0, NULL, FALSE, TRUE }
{
N_("Hide and Show menubar"),
KEY_TOGGLE_MENUBAR, ACCEL_PATH_TOGGLE_MENUBAR, 0, 0, NULL, FALSE, TRUE
},
{
N_("Full Screen"),
KEY_FULL_SCREEN, ACCEL_PATH_FULL_SCREEN, 0, GDK_F11, NULL, FALSE, TRUE
},
{
N_("Zoom In"),
KEY_ZOOM_IN, ACCEL_PATH_ZOOM_IN, GDK_CONTROL_MASK, GDK_plus, NULL, FALSE, TRUE
},
{
N_("Zoom Out"),
KEY_ZOOM_OUT, ACCEL_PATH_ZOOM_OUT, GDK_CONTROL_MASK, GDK_minus, NULL, FALSE, TRUE
},
{
N_("Normal Size"),
KEY_ZOOM_NORMAL, ACCEL_PATH_ZOOM_NORMAL, GDK_CONTROL_MASK, GDK_0, NULL, FALSE, TRUE
}
};
static KeyEntry terminal_entries[] =
{
{ N_("Set Title"),
KEY_SET_TERMINAL_TITLE, ACCEL_PATH_SET_TERMINAL_TITLE, 0, 0, NULL, FALSE, TRUE },
{ N_("Reset"),
KEY_RESET, ACCEL_PATH_RESET, 0, 0, NULL, FALSE, TRUE },
{ N_("Reset and Clear"),
KEY_RESET_AND_CLEAR, ACCEL_PATH_RESET_AND_CLEAR, 0, 0, NULL, FALSE, TRUE },
{
N_("Set Title"),
KEY_SET_TERMINAL_TITLE, ACCEL_PATH_SET_TERMINAL_TITLE, 0, 0, NULL, FALSE, TRUE
},
{
N_("Reset"),
KEY_RESET, ACCEL_PATH_RESET, 0, 0, NULL, FALSE, TRUE
},
{
N_("Reset and Clear"),
KEY_RESET_AND_CLEAR, ACCEL_PATH_RESET_AND_CLEAR, 0, 0, NULL, FALSE, TRUE
},
};
static KeyEntry tabs_entries[] =
{
{ N_("Switch to Previous Tab"),
KEY_PREV_TAB, ACCEL_PATH_PREV_TAB, GDK_CONTROL_MASK, GDK_Page_Up, NULL, FALSE, TRUE },
{ N_("Switch to Next Tab"),
KEY_NEXT_TAB, ACCEL_PATH_NEXT_TAB, GDK_CONTROL_MASK, GDK_Page_Down, NULL, FALSE, TRUE },
{ N_("Move Tab to the Left"),
KEY_MOVE_TAB_LEFT, ACCEL_PATH_MOVE_TAB_LEFT, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_Page_Up, NULL, FALSE, TRUE },
{ N_("Move Tab to the Right"),
KEY_MOVE_TAB_RIGHT, ACCEL_PATH_MOVE_TAB_RIGHT, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_Page_Down, NULL, FALSE, TRUE },
{ N_("Detach Tab"),
KEY_DETACH_TAB, ACCEL_PATH_DETACH_TAB, 0, 0, NULL, FALSE, TRUE },
{ N_("Switch to Tab 1"),
{
N_("Switch to Previous Tab"),
KEY_PREV_TAB, ACCEL_PATH_PREV_TAB, GDK_CONTROL_MASK, GDK_Page_Up, NULL, FALSE, TRUE
},
{
N_("Switch to Next Tab"),
KEY_NEXT_TAB, ACCEL_PATH_NEXT_TAB, GDK_CONTROL_MASK, GDK_Page_Down, NULL, FALSE, TRUE
},
{
N_("Move Tab to the Left"),
KEY_MOVE_TAB_LEFT, ACCEL_PATH_MOVE_TAB_LEFT, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_Page_Up, NULL, FALSE, TRUE
},
{
N_("Move Tab to the Right"),
KEY_MOVE_TAB_RIGHT, ACCEL_PATH_MOVE_TAB_RIGHT, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_Page_Down, NULL, FALSE, TRUE
},
{
N_("Detach Tab"),
KEY_DETACH_TAB, ACCEL_PATH_DETACH_TAB, 0, 0, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 1"),
KEY_SWITCH_TAB_PREFIX "1",
ACCEL_PATH_SWITCH_TAB_PREFIX "1", GDK_MOD1_MASK, GDK_1, NULL, FALSE, TRUE },
{ N_("Switch to Tab 2"),
ACCEL_PATH_SWITCH_TAB_PREFIX "1", GDK_MOD1_MASK, GDK_1, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 2"),
KEY_SWITCH_TAB_PREFIX "2",
ACCEL_PATH_SWITCH_TAB_PREFIX "2", GDK_MOD1_MASK, GDK_2, NULL, FALSE, TRUE },
{ N_("Switch to Tab 3"),
ACCEL_PATH_SWITCH_TAB_PREFIX "2", GDK_MOD1_MASK, GDK_2, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 3"),
KEY_SWITCH_TAB_PREFIX "3",
ACCEL_PATH_SWITCH_TAB_PREFIX "3", GDK_MOD1_MASK, GDK_3, NULL, FALSE, TRUE },
{ N_("Switch to Tab 4"),
ACCEL_PATH_SWITCH_TAB_PREFIX "3", GDK_MOD1_MASK, GDK_3, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 4"),
KEY_SWITCH_TAB_PREFIX "4",
ACCEL_PATH_SWITCH_TAB_PREFIX "4", GDK_MOD1_MASK, GDK_4, NULL, FALSE, TRUE },
{ N_("Switch to Tab 5"),
ACCEL_PATH_SWITCH_TAB_PREFIX "4", GDK_MOD1_MASK, GDK_4, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 5"),
KEY_SWITCH_TAB_PREFIX "5",
ACCEL_PATH_SWITCH_TAB_PREFIX "5", GDK_MOD1_MASK, GDK_5, NULL, FALSE, TRUE },
{ N_("Switch to Tab 6"),
ACCEL_PATH_SWITCH_TAB_PREFIX "5", GDK_MOD1_MASK, GDK_5, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 6"),
KEY_SWITCH_TAB_PREFIX "6",
ACCEL_PATH_SWITCH_TAB_PREFIX "6", GDK_MOD1_MASK, GDK_6, NULL, FALSE, TRUE },
{ N_("Switch to Tab 7"),
ACCEL_PATH_SWITCH_TAB_PREFIX "6", GDK_MOD1_MASK, GDK_6, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 7"),
KEY_SWITCH_TAB_PREFIX "7",
ACCEL_PATH_SWITCH_TAB_PREFIX "7", GDK_MOD1_MASK, GDK_7, NULL, FALSE, TRUE },
{ N_("Switch to Tab 8"),
ACCEL_PATH_SWITCH_TAB_PREFIX "7", GDK_MOD1_MASK, GDK_7, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 8"),
KEY_SWITCH_TAB_PREFIX "8",
ACCEL_PATH_SWITCH_TAB_PREFIX "8", GDK_MOD1_MASK, GDK_8, NULL, FALSE, TRUE },
{ N_("Switch to Tab 9"),
ACCEL_PATH_SWITCH_TAB_PREFIX "8", GDK_MOD1_MASK, GDK_8, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 9"),
KEY_SWITCH_TAB_PREFIX "9",
ACCEL_PATH_SWITCH_TAB_PREFIX "9", GDK_MOD1_MASK, GDK_9, NULL, FALSE, TRUE },
{ N_("Switch to Tab 10"),
ACCEL_PATH_SWITCH_TAB_PREFIX "9", GDK_MOD1_MASK, GDK_9, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 10"),
KEY_SWITCH_TAB_PREFIX "10",
ACCEL_PATH_SWITCH_TAB_PREFIX "10", GDK_MOD1_MASK, GDK_0, NULL, FALSE, TRUE },
{ N_("Switch to Tab 11"),
ACCEL_PATH_SWITCH_TAB_PREFIX "10", GDK_MOD1_MASK, GDK_0, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 11"),
KEY_SWITCH_TAB_PREFIX "11",
ACCEL_PATH_SWITCH_TAB_PREFIX "11", 0, 0, NULL, FALSE, TRUE },
{ N_("Switch to Tab 12"),
ACCEL_PATH_SWITCH_TAB_PREFIX "11", 0, 0, NULL, FALSE, TRUE
},
{
N_("Switch to Tab 12"),
KEY_SWITCH_TAB_PREFIX "12",
ACCEL_PATH_SWITCH_TAB_PREFIX "12", 0, 0, NULL, FALSE, TRUE }
ACCEL_PATH_SWITCH_TAB_PREFIX "12", 0, 0, NULL, FALSE, TRUE
}
};
static KeyEntry help_entries[] = {
static KeyEntry help_entries[] =
{
{ N_("Contents"), KEY_HELP, ACCEL_PATH_HELP, 0, GDK_F1, NULL, FALSE, TRUE }
};
@ -739,7 +806,8 @@ accel_edited_callback (GtkCellRendererAccel *cell,
if (!path)
return;
if (!gtk_tree_model_get_iter (model, &iter, path)) {
if (!gtk_tree_model_get_iter (model, &iter, path))
{
gtk_tree_path_free (path);
return;
}
@ -794,11 +862,14 @@ accel_edited_callback (GtkCellRendererAccel *cell,
{
GtkAccelKey old_key;
if (gtk_accel_map_lookup_entry (ke->accel_path, &old_key)) {
if (gtk_accel_map_lookup_entry (ke->accel_path, &old_key))
{
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
" Old entry of path %s is keyval %s mask %x\n",
ke->accel_path, gdk_keyval_name (old_key.accel_key), old_key.accel_mods);
} else {
}
else
{
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
" Failed to look up the old entry of path %s\n",
ke->accel_path);
@ -833,7 +904,8 @@ accel_cleared_callback (GtkCellRendererAccel *cell,
if (!path)
return;
if (!gtk_tree_model_get_iter (model, &iter, path)) {
if (!gtk_tree_model_get_iter (model, &iter, path))
{
gtk_tree_path_free (path);
return;
}

View File

@ -72,7 +72,8 @@
*
*/
struct _TerminalAppClass {
struct _TerminalAppClass
{
GObjectClass parent_class;
void (* quit) (TerminalApp *app);
@ -1667,7 +1668,8 @@ terminal_app_class_init (TerminalAppClass *klass)
TerminalApp*
terminal_app_get (void)
{
if (global_app == NULL) {
if (global_app == NULL)
{
g_object_new (TERMINAL_TYPE_APP, NULL);
g_assert (global_app != NULL);
}

View File

@ -28,7 +28,8 @@ void
_terminal_debug_init(void)
{
#ifdef MATE_ENABLE_DEBUG
const GDebugKey keys[] = {
const GDebugKey keys[] =
{
{ "accels", TERMINAL_DEBUG_ACCELS },
{ "encodings", TERMINAL_DEBUG_ENCODINGS },
{ "factory", TERMINAL_DEBUG_FACTORY },

View File

@ -25,7 +25,8 @@
G_BEGIN_DECLS
typedef enum {
typedef enum
{
TERMINAL_DEBUG_ACCELS = 1 << 0,
TERMINAL_DEBUG_ENCODINGS = 1 << 1,
TERMINAL_DEBUG_FACTORY = 1 << 2,
@ -60,7 +61,8 @@ _terminal_debug_on (TerminalDebugFlags flags)
#include <glib/gstdio.h>
static void _terminal_debug_print (guint flags, const char *fmt, ...)
{
if (_terminal_debug_on (flags)) {
if (_terminal_debug_on (flags))
{
va_list ap;
va_start (ap, fmt);
g_vfprintf (stderr, fmt, ap);

View File

@ -44,10 +44,12 @@
* labeled "user defined" but still appears in the menu.
*/
static const struct {
static const struct
{
const char *charset;
const char *name;
} encodings[] = {
} encodings[] =
{
{ "ISO-8859-1", N_("Western") },
{ "ISO-8859-2", N_("Central European") },
{ "ISO-8859-3", N_("South European") },
@ -128,7 +130,8 @@ static const struct {
#endif
};
typedef struct {
typedef struct
{
GtkWidget *dialog;
GtkListStore *base_store;
GtkTreeView *available_tree_view;
@ -271,7 +274,8 @@ terminal_encoding_get_type (void)
{
static GType type = 0;
if (G_UNLIKELY (type == 0)) {
if (G_UNLIKELY (type == 0))
{
type = g_boxed_type_register_static (I_("TerminalEncoding"),
(GBoxedCopyFunc) terminal_encoding_ref,
(GBoxedFreeFunc) terminal_encoding_unref);

View File

@ -75,7 +75,8 @@ terminal_info_bar_new (GtkMessageType type,
NULL);
va_start (args, first_button_text);
while (first_button_text != NULL) {
while (first_button_text != NULL)
{
int response_id;
response_id = va_arg (args, int);

View File

@ -937,7 +937,8 @@ terminal_options_free (TerminalOptions *options)
static GOptionContext *
get_goption_context (TerminalOptions *options)
{
const GOptionEntry global_unique_goptions[] = {
const GOptionEntry global_unique_goptions[] =
{
{
"disable-factory",
0,
@ -969,7 +970,8 @@ get_goption_context (TerminalOptions *options)
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
const GOptionEntry global_multiple_goptions[] = {
const GOptionEntry global_multiple_goptions[] =
{
{
"window",
0,
@ -991,7 +993,8 @@ get_goption_context (TerminalOptions *options)
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
const GOptionEntry window_goptions[] = {
const GOptionEntry window_goptions[] =
{
{
"show-menubar",
0,
@ -1058,7 +1061,8 @@ get_goption_context (TerminalOptions *options)
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
const GOptionEntry terminal_goptions[] = {
const GOptionEntry terminal_goptions[] =
{
{
"command",
'e',
@ -1107,7 +1111,8 @@ get_goption_context (TerminalOptions *options)
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
const GOptionEntry internal_goptions[] = {
const GOptionEntry internal_goptions[] =
{
{
"profile-id",
0,

View File

@ -86,7 +86,8 @@ typedef struct
#define TERMINAL_OPTION_ERROR (g_quark_from_static_string ("terminal-option-error"))
typedef enum {
typedef enum
{
TERMINAL_OPTION_ERROR_NOT_IN_FACTORY,
TERMINAL_OPTION_ERROR_EXCLUSIVE_OPTIONS,
TERMINAL_OPTION_ERROR_INVALID_CONFIG_FILE,

View File

@ -189,7 +189,8 @@ struct _TerminalProfilePrivate
/* We have to continue to use these since they're unfortunately different
* from the value nicks of the vte_terminal_erase_binding_get_type() enum type.
*/
static const MateConfEnumStringPair erase_bindings[] = {
static const MateConfEnumStringPair erase_bindings[] =
{
{ VTE_ERASE_AUTO, "auto" },
{ VTE_ERASE_ASCII_BACKSPACE, "control-h" },
{ VTE_ERASE_ASCII_DELETE, "ascii-del" },
@ -1110,7 +1111,8 @@ terminal_profile_set_property (GObject *object,
switch (prop_id)
{
#if 0
case PROP_FONT: {
case PROP_FONT:
{
PangoFontDescription *font_desc, *new_font_desc;
font_desc = g_value_get_boxed (prop_value);
@ -1135,7 +1137,8 @@ terminal_profile_set_property (GObject *object,
/* Postprocessing */
switch (prop_id)
{
case PROP_NAME: {
case PROP_NAME:
{
const char *name = g_value_get_string (value);
g_assert (name != NULL);

View File

@ -65,7 +65,8 @@ terminal_screen_container_set_placement_internal (TerminalScreenContainer *conta
#ifdef USE_SCROLLED_WINDOW
gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (priv->scrolled_window), corner);
#else
switch (corner) {
switch (corner)
{
case GTK_CORNER_TOP_LEFT:
case GTK_CORNER_BOTTOM_LEFT:
gtk_box_reorder_child (GTK_BOX (priv->hbox), priv->vscrollbar, 1);
@ -185,7 +186,8 @@ terminal_screen_container_get_property (GObject *object,
TerminalScreenContainer *container = TERMINAL_SCREEN_CONTAINER (object);
TerminalScreenContainerPrivate *priv = container->priv;
switch (prop_id) {
switch (prop_id)
{
case PROP_SCREEN:
break;
case PROP_HSCROLLBAR_POLICY:
@ -215,7 +217,8 @@ terminal_screen_container_set_property (GObject *object,
TerminalScreenContainer *container = TERMINAL_SCREEN_CONTAINER (object);
TerminalScreenContainerPrivate *priv = container->priv;
switch (prop_id) {
switch (prop_id)
{
case PROP_SCREEN:
priv->screen = g_value_get_object (value);
break;
@ -363,11 +366,13 @@ terminal_screen_container_set_policy (TerminalScreenContainer *container,
g_object_freeze_notify (object);
if (priv->hscrollbar_policy != hpolicy) {
if (priv->hscrollbar_policy != hpolicy)
{
priv->hscrollbar_policy = hpolicy;
g_object_notify (object, "hscrollbar-policy");
}
if (priv->vscrollbar_policy != vpolicy) {
if (priv->vscrollbar_policy != vpolicy)
{
priv->vscrollbar_policy = vpolicy;
g_object_notify (object, "vscrollbar-policy");
}
@ -375,7 +380,8 @@ terminal_screen_container_set_policy (TerminalScreenContainer *container,
#ifdef USE_SCROLLED_WINDOW
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), hpolicy, vpolicy);
#else
switch (vpolicy) {
switch (vpolicy)
{
case GTK_POLICY_NEVER:
gtk_widget_hide (priv->vscrollbar);
break;

View File

@ -81,7 +81,8 @@ enum
LAST_SIGNAL
};
enum {
enum
{
PROP_0,
PROP_PROFILE,
PROP_ICON_TITLE,
@ -151,13 +152,15 @@ static guint signals[LAST_SIGNAL];
#define USERPASS USERCHARS_CLASS "+(?:" PASSCHARS_CLASS "+)?"
#define URLPATH "(?:(/"PATHCHARS_CLASS"+(?:[(]"PATHCHARS_CLASS"*[)])*"PATHCHARS_CLASS"*)*"PATHTERM_CLASS")?"
typedef struct {
typedef struct
{
const char *pattern;
TerminalURLFlavour flavor;
GRegexCompileFlags flags;
} TerminalRegexPattern;
static const TerminalRegexPattern url_regex_patterns[] = {
static const TerminalRegexPattern url_regex_patterns[] =
{
{ SCHEME "//(?:" USERPASS "\\@)?" HOST PORT URLPATH, FLAVOR_AS_IS, G_REGEX_CASELESS },
{ "(?:www|ftp)" HOSTCHARS_CLASS "*\\." HOST PORT URLPATH , FLAVOR_DEFAULT_TO_HTTP, G_REGEX_CASELESS },
{ "(?:callto:|h323:|sip:)" USERCHARS_CLASS "[" USERCHARS ".]*(?:" PORT "/[a-z0-9]+)?\\@" HOST, FLAVOR_VOIP_CALL, G_REGEX_CASELESS },
@ -170,7 +173,8 @@ static TerminalURLFlavour *url_regex_flavors;
static guint n_url_regexes;
#ifdef ENABLE_SKEY
static const TerminalRegexPattern skey_regex_patterns[] = {
static const TerminalRegexPattern skey_regex_patterns[] =
{
{ "s/key [[:digit:]]* [-[:alnum:]]*", FLAVOR_AS_IS },
{ "otp-[a-z0-9]* [[:digit:]]* [-[:alnum:]]*", FLAVOR_AS_IS },
};
@ -186,7 +190,8 @@ G_DEFINE_TYPE (TerminalScreen, terminal_screen, VTE_TYPE_TERMINAL)
static char *
cwd_of_pid (int pid)
{
static const char patterns[][18] = {
static const char patterns[][18] =
{
"/proc/%d/cwd", /* Linux */
"/proc/%d/path/cwd", /* Solaris >= 10 */
};
@ -346,7 +351,8 @@ size_allocate (GtkWidget *widget,
static void
terminal_screen_init (TerminalScreen *screen)
{
const GtkTargetEntry target_table[] = {
const GtkTargetEntry target_table[] =
{
{ "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, TARGET_TAB },
{ "application/x-color", 0, TARGET_COLOR },
{ "property/bgimage", 0, TARGET_BGIMAGE },
@ -466,7 +472,8 @@ terminal_screen_set_property (GObject *object,
switch (prop_id)
{
case PROP_PROFILE: {
case PROP_PROFILE:
{
TerminalProfile *profile;
profile = g_value_get_object (value);
@ -708,7 +715,8 @@ terminal_screen_new (TerminalProfile *profile,
terminal_screen_set_profile (screen, profile);
if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE)) {
if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE))
{
vte_terminal_set_size (VTE_TERMINAL (screen),
terminal_profile_get_property_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS),
terminal_profile_get_property_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS));
@ -791,7 +799,8 @@ static const char *
terminal_screen_get_title_format (TerminalScreen *screen)
{
TerminalScreenPrivate *priv = screen->priv;
static const char *formats[] = {
static const char *formats[] =
{
"%A" /* TERMINAL_TITLE_REPLACE */,
"%D%-%S" /* TERMINAL_TITLE_BEFORE */,
"%S%-%D" /* TERMINAL_TITLE_AFTER */,
@ -1405,7 +1414,8 @@ get_child_environment (TerminalScreen *screen,
return (char **) g_ptr_array_free (retval, FALSE);
}
enum {
enum
{
RESPONSE_RELAUNCH,
RESPONSE_EDIT_PROFILE
};
@ -1417,7 +1427,8 @@ info_bar_response_cb (GtkWidget *info_bar,
{
gtk_widget_grab_focus (GTK_WIDGET (screen));
switch (response) {
switch (response)
{
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (info_bar);
g_signal_emit (screen, signals[CLOSE_SCREEN], 0);
@ -1481,7 +1492,8 @@ terminal_screen_launch_child_cb (TerminalScreen *screen)
spawn_flags,
NULL, NULL,
&pid,
&err)) {
&err))
{
GtkWidget *info_bar;
info_bar = terminal_info_bar_new (GTK_MESSAGE_ERROR,
@ -1753,7 +1765,8 @@ terminal_screen_get_current_dir (TerminalScreen *screen)
TerminalScreenPrivate *priv = screen->priv;
char *cwd;
if (priv->pty_fd != -1) {
if (priv->pty_fd != -1)
{
#if 0
/* Get the foreground process ID */
cwd = cwd_of_pid (tcgetpgrp (priv->pty_fd));
@ -1866,7 +1879,8 @@ terminal_screen_child_exited (VteTerminal *terminal)
case TERMINAL_EXIT_RESTART:
terminal_screen_launch_child_on_idle (screen);
break;
case TERMINAL_EXIT_HOLD: {
case TERMINAL_EXIT_HOLD:
{
GtkWidget *info_bar;
int status;
@ -1875,13 +1889,18 @@ terminal_screen_child_exited (VteTerminal *terminal)
info_bar = terminal_info_bar_new (GTK_MESSAGE_INFO,
_("_Relaunch"), RESPONSE_RELAUNCH,
NULL);
if (WIFEXITED (status)) {
if (WIFEXITED (status))
{
terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
_("The child process exited normally with status %d."), WEXITSTATUS (status));
} else if (WIFSIGNALED (status)) {
}
else if (WIFSIGNALED (status))
{
terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
_("The child process was terminated by signal %d."), WTERMSIG (status));
} else {
}
else
{
terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
_("The child process was terminated."));
}

View File

@ -27,7 +27,8 @@
G_BEGIN_DECLS
typedef enum {
typedef enum
{
FLAVOR_AS_IS,
FLAVOR_DEFAULT_TO_HTTP,
FLAVOR_VOIP_CALL,
@ -140,7 +141,8 @@ gboolean terminal_screen_has_foreground_process (TerminalScreen *screen);
#define TERMINAL_SCALE_MINIMUM (TERMINAL_SCALE_XXXXX_SMALL/1.2)
#define TERMINAL_SCALE_MAXIMUM (TERMINAL_SCALE_XXXXX_LARGE*1.2)
struct _TerminalScreenPopupInfo {
struct _TerminalScreenPopupInfo
{
int ref_count;
TerminalWindow *window;
TerminalScreen *screen;

View File

@ -169,7 +169,8 @@ update_sensitivity (void *unused, GtkWidget *dialog)
const gchar *search_string;
gboolean valid;
if (priv->regex) {
if (priv->regex)
{
g_regex_unref (priv->regex);
priv->regex = NULL;
}
@ -179,7 +180,8 @@ update_sensitivity (void *unused, GtkWidget *dialog)
valid = *search_string != '\0';
if (valid && GET_FLAG (regex_checkbutton)) {
if (valid && GET_FLAG (regex_checkbutton))
{
/* Check that the regex is valid */
valid = NULL != terminal_search_dialog_get_regex (dialog);
/* TODO show the error message somewhere */
@ -199,19 +201,22 @@ remove_item (GtkListStore *store,
if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter))
return FALSE;
do {
do
{
gchar *item_text;
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &item_text, -1);
if (item_text != NULL && strcmp (item_text, text) == 0) {
if (item_text != NULL && strcmp (item_text, text) == 0)
{
gtk_list_store_remove (store, &iter);
g_free (item_text);
return TRUE;
}
g_free (item_text);
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
}
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
return FALSE;
}
@ -265,7 +270,8 @@ response_handler (GtkWidget *dialog,
TerminalSearchDialogPrivate *priv;
const gchar *str;
if (response_id != GTK_RESPONSE_ACCEPT) {
if (response_id != GTK_RESPONSE_ACCEPT)
{
gtk_widget_hide (dialog);
return;
}
@ -354,14 +360,16 @@ terminal_search_dialog_get_regex (GtkWidget *dialog)
else
pattern = g_regex_escape_string (text, -1);
if (GET_FLAG (entire_word_checkbutton)) {
if (GET_FLAG (entire_word_checkbutton))
{
const char *old_pattern = pattern;
pattern = g_strdup_printf ("\\b%s\\b", pattern);
if (old_pattern != text)
g_free ((char *) old_pattern);
}
if (!priv->regex || priv->regex_compile_flags != compile_flags) {
if (!priv->regex || priv->regex_compile_flags != compile_flags)
{
priv->regex_compile_flags = compile_flags;
if (priv->regex)
g_regex_unref (priv->regex);

View File

@ -25,7 +25,8 @@
G_BEGIN_DECLS
typedef enum _TerminalSearchFlags {
typedef enum _TerminalSearchFlags
{
TERMINAL_SEARCH_FLAG_BACKWARDS = 1 << 0,
TERMINAL_SEARCH_FLAG_WRAP_AROUND = 1 << 1
} TerminalSearchFlags;

View File

@ -183,7 +183,8 @@ terminal_tab_label_set_property (GObject *object,
TerminalTabLabel *tab_label = TERMINAL_TAB_LABEL (object);
TerminalTabLabelPrivate *priv = tab_label->priv;
switch (prop_id) {
switch (prop_id)
{
case PROP_SCREEN:
priv->screen = g_value_get_object (value);
break;
@ -266,7 +267,8 @@ terminal_tab_label_set_bold (TerminalTabLabel *tab_label,
priv->bold = bold;
attr_list = gtk_label_get_attributes (GTK_LABEL (priv->label));
if (!attr_list) {
if (!attr_list)
{
attr_list = pango_attr_list_new ();
free_list = TRUE;
}

View File

@ -151,9 +151,11 @@ terminal_util_show_help (const char *topic,
guint i;
const char * const * langs = g_get_language_names ();
for (i = 0; langs[i]; i++) {
for (i = 0; langs[i]; i++)
{
lang = langs[i];
if (strchr (lang, '.')) {
if (strchr (lang, '.'))
{
continue;
}
@ -163,7 +165,8 @@ terminal_util_show_help (const char *topic,
"mate-terminal.xml",
NULL);
if (g_file_test (uri, G_FILE_TEST_EXISTS)) {
if (g_file_test (uri, G_FILE_TEST_EXISTS))
{
break;
}
@ -174,9 +177,12 @@ terminal_util_show_help (const char *topic,
if (!uri)
return;
if (topic) {
if (topic)
{
url = g_strdup_printf ("ghelp://%s?%s", uri, topic);
} else {
}
else
{
url = g_strdup_printf ("ghelp://%s", uri);
}
@ -362,7 +368,8 @@ terminal_util_concat_uris (char **uris,
char *
terminal_util_get_licence_text (void)
{
const gchar *license[] = {
const gchar *license[] =
{
N_("MATE Terminal is free software; you can redistribute it and/or modify "
"it under the terms of the GNU General Public License as published by "
"the Free Software Foundation; either version 3 of the License, or "
@ -391,7 +398,8 @@ terminal_util_load_builder_file (const char *filename,
path = g_build_filename (TERM_PKGDATADIR, filename, NULL);
builder = gtk_builder_new ();
if (!gtk_builder_add_from_file (builder, path, &error)) {
if (!gtk_builder_add_from_file (builder, path, &error))
{
g_warning ("Failed to load %s: %s\n", filename, error->message);
g_error_free (error);
g_free (path);
@ -402,12 +410,14 @@ terminal_util_load_builder_file (const char *filename,
va_start (args, object_name);
while (object_name) {
while (object_name)
{
GObject **objectptr;
objectptr = va_arg (args, GObject**);
*objectptr = gtk_builder_get_object (builder, object_name);
if (!*objectptr) {
if (!*objectptr)
{
g_warning ("Failed to fetch object \"%s\"\n", object_name);
break;
}
@ -748,7 +758,8 @@ terminal_util_add_proxy_env (GHashTable *env_table)
/* Bidirectional object/widget binding */
typedef struct {
typedef struct
{
GObject *object;
const char *object_prop;
GtkWidget *widget;

View File

@ -89,7 +89,8 @@ char **terminal_util_key_file_get_argv (GKeyFile *key_file,
void terminal_util_add_proxy_env (GHashTable *env_table);
typedef enum {
typedef enum
{
FLAG_INVERT_BOOL = 1 << 0,
} PropertyChangeFlags;

View File

@ -899,10 +899,12 @@ terminal_size_to_cb (GtkAction *action,
static void
terminal_window_update_size_to_menu (TerminalWindow *window)
{
static const struct {
static const struct
{
guint grid_width;
guint grid_height;
} predefined_sizes[] = {
} predefined_sizes[] =
{
{ 80, 24 },
{ 80, 43 },
{ 132, 24 },
@ -1801,182 +1803,280 @@ terminal_window_init (TerminalWindow *window)
{ "NotebookPopup", NULL, "" },
/* File menu */
{ "FileNewWindow", STOCK_NEW_WINDOW, N_("Open _Terminal"), "<shift><control>N",
{
"FileNewWindow", STOCK_NEW_WINDOW, N_("Open _Terminal"), "<shift><control>N",
NULL,
G_CALLBACK (file_new_window_callback) },
{ "FileNewTab", STOCK_NEW_TAB, N_("Open Ta_b"), "<shift><control>T",
G_CALLBACK (file_new_window_callback)
},
{
"FileNewTab", STOCK_NEW_TAB, N_("Open Ta_b"), "<shift><control>T",
NULL,
G_CALLBACK (file_new_tab_callback) },
{ "FileNewProfile", GTK_STOCK_OPEN, N_("New _Profile…"), "",
G_CALLBACK (file_new_tab_callback)
},
{
"FileNewProfile", GTK_STOCK_OPEN, N_("New _Profile…"), "",
NULL,
G_CALLBACK (file_new_profile_callback) },
{ "FileSaveContents", GTK_STOCK_SAVE, N_("_Save Contents"), "",
G_CALLBACK (file_new_profile_callback)
},
{
"FileSaveContents", GTK_STOCK_SAVE, N_("_Save Contents"), "",
NULL,
G_CALLBACK (file_save_contents_callback) },
{ "FileCloseTab", GTK_STOCK_CLOSE, N_("C_lose Tab"), "<shift><control>W",
G_CALLBACK (file_save_contents_callback)
},
{
"FileCloseTab", GTK_STOCK_CLOSE, N_("C_lose Tab"), "<shift><control>W",
NULL,
G_CALLBACK (file_close_tab_callback) },
{ "FileCloseWindow", GTK_STOCK_CLOSE, N_("_Close Window"), "<shift><control>Q",
G_CALLBACK (file_close_tab_callback)
},
{
"FileCloseWindow", GTK_STOCK_CLOSE, N_("_Close Window"), "<shift><control>Q",
NULL,
G_CALLBACK (file_close_window_callback) },
G_CALLBACK (file_close_window_callback)
},
/* Edit menu */
{ "EditCopy", GTK_STOCK_COPY, NULL, "<shift><control>C",
{
"EditCopy", GTK_STOCK_COPY, NULL, "<shift><control>C",
NULL,
G_CALLBACK (edit_copy_callback) },
{ "EditPaste", GTK_STOCK_PASTE, NULL, "<shift><control>V",
G_CALLBACK (edit_copy_callback)
},
{
"EditPaste", GTK_STOCK_PASTE, NULL, "<shift><control>V",
NULL,
G_CALLBACK (edit_paste_callback) },
{ "EditPasteURIPaths", GTK_STOCK_PASTE, N_("Paste _Filenames"), "",
G_CALLBACK (edit_paste_callback)
},
{
"EditPasteURIPaths", GTK_STOCK_PASTE, N_("Paste _Filenames"), "",
NULL,
G_CALLBACK (edit_paste_callback) },
{ "EditSelectAll", GTK_STOCK_SELECT_ALL, NULL, NULL,
G_CALLBACK (edit_paste_callback)
},
{
"EditSelectAll", GTK_STOCK_SELECT_ALL, NULL, NULL,
NULL,
G_CALLBACK (edit_select_all_callback) },
{ "EditProfiles", NULL, N_("P_rofiles…"), NULL,
G_CALLBACK (edit_select_all_callback)
},
{
"EditProfiles", NULL, N_("P_rofiles…"), NULL,
NULL,
G_CALLBACK (edit_profiles_callback) },
{ "EditKeybindings", NULL, N_("_Keyboard Shortcuts…"), NULL,
G_CALLBACK (edit_profiles_callback)
},
{
"EditKeybindings", NULL, N_("_Keyboard Shortcuts…"), NULL,
NULL,
G_CALLBACK (edit_keybindings_callback) },
{ "EditCurrentProfile", NULL, N_("Pr_ofile Preferences"), NULL,
G_CALLBACK (edit_keybindings_callback)
},
{
"EditCurrentProfile", NULL, N_("Pr_ofile Preferences"), NULL,
NULL,
G_CALLBACK (edit_current_profile_callback) },
G_CALLBACK (edit_current_profile_callback)
},
/* View menu */
{ "ViewZoomIn", GTK_STOCK_ZOOM_IN, NULL, "<control>plus",
{
"ViewZoomIn", GTK_STOCK_ZOOM_IN, NULL, "<control>plus",
NULL,
G_CALLBACK (view_zoom_in_callback) },
{ "ViewZoomOut", GTK_STOCK_ZOOM_OUT, NULL, "<control>minus",
G_CALLBACK (view_zoom_in_callback)
},
{
"ViewZoomOut", GTK_STOCK_ZOOM_OUT, NULL, "<control>minus",
NULL,
G_CALLBACK (view_zoom_out_callback) },
{ "ViewZoom100", GTK_STOCK_ZOOM_100, NULL, "<control>0",
G_CALLBACK (view_zoom_out_callback)
},
{
"ViewZoom100", GTK_STOCK_ZOOM_100, NULL, "<control>0",
NULL,
G_CALLBACK (view_zoom_normal_callback) },
G_CALLBACK (view_zoom_normal_callback)
},
/* Search menu */
{ "SearchFind", GTK_STOCK_FIND, N_("_Find..."), "<shift><control>F",
{
"SearchFind", GTK_STOCK_FIND, N_("_Find..."), "<shift><control>F",
NULL,
G_CALLBACK (search_find_callback) },
{ "SearchFindNext", NULL, N_("Find Ne_xt"), "<shift><control>H",
G_CALLBACK (search_find_callback)
},
{
"SearchFindNext", NULL, N_("Find Ne_xt"), "<shift><control>H",
NULL,
G_CALLBACK (search_find_next_callback) },
{ "SearchFindPrevious", NULL, N_("Find Pre_vious"), "<shift><control>G",
G_CALLBACK (search_find_next_callback)
},
{
"SearchFindPrevious", NULL, N_("Find Pre_vious"), "<shift><control>G",
NULL,
G_CALLBACK (search_find_prev_callback) },
{ "SearchClearHighlight", NULL, N_("_Clear Highlight"), "<shift><control>J",
G_CALLBACK (search_find_prev_callback)
},
{
"SearchClearHighlight", NULL, N_("_Clear Highlight"), "<shift><control>J",
NULL,
G_CALLBACK (search_clear_highlight_callback) },
G_CALLBACK (search_clear_highlight_callback)
},
#if 0
{ "SearchGoToLine", GTK_STOCK_JUMP_TO, N_("Go to _Line..."), "<shift><control>I",
{
"SearchGoToLine", GTK_STOCK_JUMP_TO, N_("Go to _Line..."), "<shift><control>I",
NULL,
G_CALLBACK (search_goto_line_callback) },
{ "SearchIncrementalSearch", GTK_STOCK_FIND, N_("_Incremental Search..."), "<shift><control>K",
G_CALLBACK (search_goto_line_callback)
},
{
"SearchIncrementalSearch", GTK_STOCK_FIND, N_("_Incremental Search..."), "<shift><control>K",
NULL,
G_CALLBACK (search_incremental_search_callback) },
G_CALLBACK (search_incremental_search_callback)
},
#endif
/* Terminal menu */
{ "TerminalProfiles", NULL, N_("Change _Profile") },
{ "TerminalSetTitle", NULL, N_("_Set Title…"), NULL,
{
"TerminalSetTitle", NULL, N_("_Set Title…"), NULL,
NULL,
G_CALLBACK (terminal_set_title_callback) },
G_CALLBACK (terminal_set_title_callback)
},
{ "TerminalSetEncoding", NULL, N_("Set _Character Encoding") },
{ "TerminalReset", NULL, N_("_Reset"), NULL,
{
"TerminalReset", NULL, N_("_Reset"), NULL,
NULL,
G_CALLBACK (terminal_reset_callback) },
{ "TerminalResetClear", NULL, N_("Reset and C_lear"), NULL,
G_CALLBACK (terminal_reset_callback)
},
{
"TerminalResetClear", NULL, N_("Reset and C_lear"), NULL,
NULL,
G_CALLBACK (terminal_reset_clear_callback) },
G_CALLBACK (terminal_reset_clear_callback)
},
/* Terminal/Encodings menu */
{ "TerminalAddEncoding", NULL, N_("_Add or Remove…"), NULL,
{
"TerminalAddEncoding", NULL, N_("_Add or Remove…"), NULL,
NULL,
G_CALLBACK (terminal_add_encoding_callback) },
G_CALLBACK (terminal_add_encoding_callback)
},
/* Tabs menu */
{ "TabsPrevious", NULL, N_("_Previous Tab"), "<control>Page_Up",
{
"TabsPrevious", NULL, N_("_Previous Tab"), "<control>Page_Up",
NULL,
G_CALLBACK (tabs_next_or_previous_tab_cb) },
{ "TabsNext", NULL, N_("_Next Tab"), "<control>Page_Down",
G_CALLBACK (tabs_next_or_previous_tab_cb)
},
{
"TabsNext", NULL, N_("_Next Tab"), "<control>Page_Down",
NULL,
G_CALLBACK (tabs_next_or_previous_tab_cb) },
{ "TabsMoveLeft", NULL, N_("Move Tab _Left"), "<shift><control>Page_Up",
G_CALLBACK (tabs_next_or_previous_tab_cb)
},
{
"TabsMoveLeft", NULL, N_("Move Tab _Left"), "<shift><control>Page_Up",
NULL,
G_CALLBACK (tabs_move_left_callback) },
{ "TabsMoveRight", NULL, N_("Move Tab _Right"), "<shift><control>Page_Down",
G_CALLBACK (tabs_move_left_callback)
},
{
"TabsMoveRight", NULL, N_("Move Tab _Right"), "<shift><control>Page_Down",
NULL,
G_CALLBACK (tabs_move_right_callback) },
{ "TabsDetach", NULL, N_("_Detach tab"), NULL,
G_CALLBACK (tabs_move_right_callback)
},
{
"TabsDetach", NULL, N_("_Detach tab"), NULL,
NULL,
G_CALLBACK (tabs_detach_tab_callback) },
G_CALLBACK (tabs_detach_tab_callback)
},
/* Help menu */
{ "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1",
{
"HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1",
NULL,
G_CALLBACK (help_contents_callback) },
{ "HelpAbout", GTK_STOCK_ABOUT, N_("_About"), NULL,
G_CALLBACK (help_contents_callback)
},
{
"HelpAbout", GTK_STOCK_ABOUT, N_("_About"), NULL,
NULL,
G_CALLBACK (help_about_callback) },
G_CALLBACK (help_about_callback)
},
/* Popup menu */
{ "PopupSendEmail", NULL, N_("_Send Mail To…"), NULL,
{
"PopupSendEmail", NULL, N_("_Send Mail To…"), NULL,
NULL,
G_CALLBACK (popup_open_url_callback) },
{ "PopupCopyEmailAddress", NULL, N_("_Copy E-mail Address"), NULL,
G_CALLBACK (popup_open_url_callback)
},
{
"PopupCopyEmailAddress", NULL, N_("_Copy E-mail Address"), NULL,
NULL,
G_CALLBACK (popup_copy_url_callback) },
{ "PopupCall", NULL, N_("C_all To…"), NULL,
G_CALLBACK (popup_copy_url_callback)
},
{
"PopupCall", NULL, N_("C_all To…"), NULL,
NULL,
G_CALLBACK (popup_open_url_callback) },
{ "PopupCopyCallAddress", NULL, N_("_Copy Call Address"), NULL,
G_CALLBACK (popup_open_url_callback)
},
{
"PopupCopyCallAddress", NULL, N_("_Copy Call Address"), NULL,
NULL,
G_CALLBACK (popup_copy_url_callback) },
{ "PopupOpenLink", NULL, N_("_Open Link"), NULL,
G_CALLBACK (popup_copy_url_callback)
},
{
"PopupOpenLink", NULL, N_("_Open Link"), NULL,
NULL,
G_CALLBACK (popup_open_url_callback) },
{ "PopupCopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
G_CALLBACK (popup_open_url_callback)
},
{
"PopupCopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
NULL,
G_CALLBACK (popup_copy_url_callback) },
G_CALLBACK (popup_copy_url_callback)
},
{ "PopupTerminalProfiles", NULL, N_("P_rofiles") },
{ "PopupCopy", GTK_STOCK_COPY, NULL, "",
{
"PopupCopy", GTK_STOCK_COPY, NULL, "",
NULL,
G_CALLBACK (edit_copy_callback) },
{ "PopupPaste", GTK_STOCK_PASTE, NULL, "",
G_CALLBACK (edit_copy_callback)
},
{
"PopupPaste", GTK_STOCK_PASTE, NULL, "",
NULL,
G_CALLBACK (edit_paste_callback) },
{ "PopupPasteURIPaths", GTK_STOCK_PASTE, N_("Paste _Filenames"), "",
G_CALLBACK (edit_paste_callback)
},
{
"PopupPasteURIPaths", GTK_STOCK_PASTE, N_("Paste _Filenames"), "",
NULL,
G_CALLBACK (edit_paste_callback) },
{ "PopupNewTerminal", NULL, N_("Open _Terminal"), NULL,
G_CALLBACK (edit_paste_callback)
},
{
"PopupNewTerminal", NULL, N_("Open _Terminal"), NULL,
NULL,
G_CALLBACK (file_new_window_callback) },
{ "PopupNewTab", NULL, N_("Open Ta_b"), NULL,
G_CALLBACK (file_new_window_callback)
},
{
"PopupNewTab", NULL, N_("Open Ta_b"), NULL,
NULL,
G_CALLBACK (file_new_tab_callback) },
{ "PopupCloseWindow", NULL, N_("C_lose Window"), NULL,
G_CALLBACK (file_new_tab_callback)
},
{
"PopupCloseWindow", NULL, N_("C_lose Window"), NULL,
NULL,
G_CALLBACK (file_close_window_callback) },
{ "PopupCloseTab", NULL, N_("C_lose Tab"), NULL,
G_CALLBACK (file_close_window_callback)
},
{
"PopupCloseTab", NULL, N_("C_lose Tab"), NULL,
NULL,
G_CALLBACK (file_close_tab_callback) },
{ "PopupLeaveFullscreen", NULL, N_("L_eave Full Screen"), NULL,
G_CALLBACK (file_close_tab_callback)
},
{
"PopupLeaveFullscreen", NULL, N_("L_eave Full Screen"), NULL,
NULL,
G_CALLBACK (popup_leave_fullscreen_callback) },
G_CALLBACK (popup_leave_fullscreen_callback)
},
{ "PopupInputMethods", NULL, N_("_Input Methods") }
};
const GtkToggleActionEntry toggle_menu_entries[] =
{
/* View Menu */
{ "ViewMenubar", NULL, N_("Show _Menubar"), NULL,
{
"ViewMenubar", NULL, N_("Show _Menubar"), NULL,
NULL,
G_CALLBACK (view_menubar_toggled_callback),
FALSE },
{ "ViewFullscreen", NULL, N_("_Full Screen"), NULL,
FALSE
},
{
"ViewFullscreen", NULL, N_("_Full Screen"), NULL,
NULL,
G_CALLBACK (view_fullscreen_toggled_callback),
FALSE }
FALSE
}
};
TerminalWindowPrivate *priv;
TerminalApp *app;
@ -2607,10 +2707,12 @@ terminal_window_set_size_force_grid (TerminalWindow *window,
window,
grid_width, grid_height, force_grid_width, force_grid_height, w, h);
if (even_if_mapped && gtk_widget_get_mapped (app)) {
if (even_if_mapped && gtk_widget_get_mapped (app))
{
gtk_window_resize (GTK_WINDOW (app), w, h);
}
else {
else
{
gtk_window_set_default_size (GTK_WINDOW (app), w, h);
}
}
@ -2744,7 +2846,8 @@ notebook_page_selected_callback (GtkWidget *notebook,
if (priv->active_screen == screen)
return;
if (priv->active_screen != NULL) {
if (priv->active_screen != NULL)
{
terminal_screen_get_size (priv->active_screen, &old_grid_width, &old_grid_height);
/* This is so that we maintain the same grid */
@ -3314,7 +3417,8 @@ edit_copy_callback (GtkAction *action,
vte_terminal_copy_clipboard (VTE_TERMINAL (priv->active_screen));
}
typedef struct {
typedef struct
{
TerminalScreen *screen;
gboolean uris_as_paths;
} PasteData;
@ -3327,7 +3431,8 @@ clipboard_uris_received_cb (GtkClipboard *clipboard,
char *text;
gsize len;
if (!uris) {
if (!uris)
{
g_object_unref (data->screen);
g_slice_free (PasteData, data);
return;
@ -3351,18 +3456,22 @@ clipboard_targets_received_cb (GtkClipboard *clipboard,
int n_targets,
PasteData *data)
{
if (!targets) {
if (!targets)
{
g_object_unref (data->screen);
g_slice_free (PasteData, data);
return;
}
if (gtk_targets_include_uri (targets, n_targets)) {
if (gtk_targets_include_uri (targets, n_targets))
{
gtk_clipboard_request_uris (clipboard,
(GtkClipboardURIReceivedFunc) clipboard_uris_received_cb,
data);
return;
} else /* if (gtk_targets_include_text (targets, n_targets)) */ {
}
else /* if (gtk_targets_include_text (targets, n_targets)) */
{
vte_terminal_paste_clipboard (VTE_TERMINAL (data->screen));
}
@ -3464,7 +3573,8 @@ view_fullscreen_toggled_callback (GtkToggleAction *action,
gtk_window_unfullscreen (GTK_WINDOW (window));
}
static const double zoom_factors[] = {
static const double zoom_factors[] =
{
TERMINAL_SCALE_MINIMUM,
TERMINAL_SCALE_XXXXX_SMALL,
TERMINAL_SCALE_XXXX_SMALL,
@ -3621,7 +3731,8 @@ search_find_callback (GtkAction *action,
{
TerminalWindowPrivate *priv = window->priv;
if (!priv->search_find_dialog) {
if (!priv->search_find_dialog)
{
GtkWidget *dialog;
dialog = priv->search_find_dialog = terminal_search_dialog_new (GTK_WINDOW (window));
@ -3788,9 +3899,12 @@ tabs_next_or_previous_tab_cb (GtkAction *action,
guint keyval = 0;
name = gtk_action_get_name (action);
if (strcmp (name, "TabsNext") == 0) {
if (strcmp (name, "TabsNext") == 0)
{
keyval = GDK_Page_Down;
} else if (strcmp (name, "TabsPrevious") == 0) {
}
else if (strcmp (name, "TabsPrevious") == 0)
{
keyval = GDK_Page_Up;
}

View File

@ -60,7 +60,8 @@ ay_to_string (GVariant *variant,
return NULL;
/* Make sure there are no embedded NULs */
if (memchr (data, '\0', len) != NULL) {
if (memchr (data, '\0', len) != NULL)
{
g_set_error_literal (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"String is shorter than claimed");
return NULL;
@ -79,7 +80,8 @@ ay_to_strv (GVariant *variant,
gssize len;
data = g_variant_get_fixed_array (variant, &data_len, sizeof (char));
if (data_len == 0 || data_len > G_MAXSSIZE) {
if (data_len == 0 || data_len > G_MAXSSIZE)
{
*argc = 0;
return NULL;
}
@ -87,7 +89,8 @@ ay_to_strv (GVariant *variant,
argv = g_ptr_array_new ();
len = data_len;
do {
do
{
gssize string_len;
nullbyte = memchr (data, '\0', len);
@ -97,7 +100,8 @@ ay_to_strv (GVariant *variant,
len -= string_len + 1;
data += string_len + 1;
} while (len > 0);
}
while (len > 0);
if (argc)
*argc = argv->len;
@ -119,7 +123,8 @@ string_to_ay (const char *string)
return g_variant_new_from_data (G_VARIANT_TYPE ("ay"), data, len, TRUE, g_free, data);
}
typedef struct {
typedef struct
{
char *factory_name;
TerminalOptions *options;
int exit_code;
@ -137,7 +142,8 @@ method_call_cb (GDBusConnection *connection,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
if (g_strcmp0 (method_name, "HandleArguments") == 0) {
if (g_strcmp0 (method_name, "HandleArguments") == 0)
{
TerminalOptions *options = NULL;
GVariant *v_wd, *v_display, *v_sid, *v_envv, *v_argv;
char *working_directory = NULL, *display_name = NULL, *startup_id = NULL;
@ -176,7 +182,8 @@ method_call_cb (GDBusConnection *connection,
&error,
NULL);
if (options != NULL) {
if (options != NULL)
{
terminal_app_handle_options (terminal_app_get (), options, FALSE /* no resume */, &error);
terminal_options_free (options);
}
@ -193,9 +200,12 @@ method_call_cb (GDBusConnection *connection,
g_variant_unref (v_argv);
g_strfreev (argv);
if (error == NULL) {
if (error == NULL)
{
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
} else {
}
else
{
g_dbus_method_invocation_return_gerror (invocation, error);
g_error_free (error);
}
@ -220,7 +230,8 @@ bus_acquired_cb (GDBusConnection *connection,
"</interface>"
"</node>";
static const GDBusInterfaceVTable interface_vtable = {
static const GDBusInterfaceVTable interface_vtable =
{
method_call_cb,
NULL,
NULL,
@ -245,7 +256,8 @@ bus_acquired_cb (GDBusConnection *connection,
&error);
g_dbus_node_info_unref (introspection_data);
if (registration_id == 0) {
if (registration_id == 0)
{
g_printerr ("Failed to register object: %s\n", error->message);
g_error_free (error);
data->exit_code = EXIT_FAILURE;
@ -264,13 +276,15 @@ name_acquired_cb (GDBusConnection *connection,
_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
"Acquired the name %s on the session bus\n", name);
if (data->options == NULL) {
if (data->options == NULL)
{
/* Name re-acquired!? */
g_assert_not_reached ();
}
if (!terminal_app_handle_options (terminal_app_get (), data->options, TRUE /* do resume */, &error)) {
if (!terminal_app_handle_options (terminal_app_get (), data->options, TRUE /* do resume */, &error))
{
g_printerr ("Failed to handle options: %s\n", error->message);
g_error_free (error);
data->exit_code = EXIT_FAILURE;
@ -300,13 +314,15 @@ name_lost_cb (GDBusConnection *connection,
"Lost the name %s on the session bus\n", name);
/* Couldn't get the connection? No way to continue! */
if (connection == NULL) {
if (connection == NULL)
{
data->exit_code = EXIT_FAILURE;
gtk_main_quit ();
return;
}
if (data->options == NULL) {
if (data->options == NULL)
{
/* Already handled */
data->exit_code = EXIT_SUCCESS;
gtk_main_quit ();
@ -369,12 +385,15 @@ name_lost_cb (GDBusConnection *connection,
-1,
NULL,
&error);
if (value == NULL) {
if (value == NULL)
{
g_printerr ("Failed to forward arguments: %s\n", error->message);
g_error_free (error);
data->exit_code = EXIT_FAILURE;
gtk_main_quit ();
} else {
}
else
{
g_variant_unref (value);
data->exit_code = EXIT_SUCCESS;
}
@ -540,7 +559,8 @@ main (int argc, char **argv)
g_free (working_directory);
if (options == NULL) {
if (options == NULL)
{
g_printerr (_("Failed to parse arguments: %s\n"), error->message);
g_error_free (error);
exit (EXIT_FAILURE);
@ -570,7 +590,8 @@ main (int argc, char **argv)
display_name = gdk_display_get_name (display);
options->display_name = g_strdup (display_name);
if (options->use_factory) {
if (options->use_factory)
{
OwnData *data;
guint owner_id;
@ -597,14 +618,19 @@ main (int argc, char **argv)
g_free (data->factory_name);
g_free (data);
} else {
}
else
{
terminal_app_handle_options (terminal_app_get (), options, TRUE /* allow resume */, &error);
terminal_options_free (options);
if (error == NULL) {
if (error == NULL)
{
gtk_main ();
} else {
}
else
{
g_printerr ("Error handling options: %s\n", error->message);
g_error_free (error);
ret = EXIT_FAILURE;