Revision: 2726 http://geany.svn.sourceforge.net/geany/?rev=2726&view=rev Author: ntrel Date: 2008-06-26 09:14:00 -0700 (Thu, 26 Jun 2008)
Log Message: ----------- Move struct _VteTerminal, VteFunctions from vte.h to vte.c. Call vte_restart() in vte_keypress() as the code is the same.
Modified Paths: -------------- trunk/ChangeLog trunk/src/vte.c trunk/src/vte.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-06-25 17:38:31 UTC (rev 2725) +++ trunk/ChangeLog 2008-06-26 16:14:00 UTC (rev 2726) @@ -1,3 +1,10 @@ +2008-06-26 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/vte.c, src/vte.h: + Move struct _VteTerminal, VteFunctions from vte.h to vte.c. + Call vte_restart() in vte_keypress() as the code is the same. + + 2008-06-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/interface.c, src/prefs.c, src/keyfile.c, src/search.c,
Modified: trunk/src/vte.c =================================================================== --- trunk/src/vte.c 2008-06-25 17:38:31 UTC (rev 2725) +++ trunk/src/vte.c 2008-06-26 16:14:00 UTC (rev 2726) @@ -61,11 +61,58 @@ static const gchar VTE_WORDCHARS[] = "-A-Za-z0-9,./?%&#:_";
+/* taken from original vte.h to make my life easier ;-) */ + +typedef struct _VteTerminalPrivate VteTerminalPrivate; + +typedef struct _VteTerminal VteTerminal; +struct _VteTerminal +{ + GtkWidget widget; + GtkAdjustment *adjustment; + glong char_width, char_height; + glong char_ascent, char_descent; + glong row_count, column_count; + gchar *window_title; + gchar *icon_title; + VteTerminalPrivate *pvt; +}; + #define VTE_TERMINAL(obj) (GTK_CHECK_CAST((obj), VTE_TYPE_TERMINAL, VteTerminal)) #define VTE_TYPE_TERMINAL (vf->vte_terminal_get_type())
+ +/* store function pointers in a struct to avoid a strange segfault if they are stored directly + * if accessed directly, gdb says the segfault arrives at old_tab_width(prefs.c), don't ask me */ +struct VteFunctions +{ + GtkWidget* (*vte_terminal_new) (void); + pid_t (*vte_terminal_fork_command) (VteTerminal *terminal, const char *command, char **argv, + char **envv, const char *directory, gboolean lastlog, + gboolean utmp, gboolean wtmp); + void (*vte_terminal_set_size) (VteTerminal *terminal, glong columns, glong rows); + void (*vte_terminal_set_word_chars) (VteTerminal *terminal, const char *spec); + void (*vte_terminal_set_mouse_autohide) (VteTerminal *terminal, gboolean setting); + void (*vte_terminal_reset) (VteTerminal *terminal, gboolean full, gboolean clear_history); + GtkType (*vte_terminal_get_type) (void); + void (*vte_terminal_set_scroll_on_output) (VteTerminal *terminal, gboolean scroll); + void (*vte_terminal_set_scroll_on_keystroke) (VteTerminal *terminal, gboolean scroll); + void (*vte_terminal_set_font_from_string) (VteTerminal *terminal, const char *name); + void (*vte_terminal_set_scrollback_lines) (VteTerminal *terminal, glong lines); + gboolean (*vte_terminal_get_has_selection) (VteTerminal *terminal); + void (*vte_terminal_copy_clipboard) (VteTerminal *terminal); + void (*vte_terminal_paste_clipboard) (VteTerminal *terminal); + void (*vte_terminal_set_emulation) (VteTerminal *terminal, const gchar *emulation); + void (*vte_terminal_set_color_foreground) (VteTerminal *terminal, const GdkColor *foreground); + void (*vte_terminal_set_color_background) (VteTerminal *terminal, const GdkColor *background); + void (*vte_terminal_feed_child) (VteTerminal *terminal, const char *data, glong length); + void (*vte_terminal_im_append_menuitems) (VteTerminal *terminal, GtkMenuShell *menushell); +}; + + static void create_vte(void); static void vte_start(GtkWidget *widget); +static void vte_restart(GtkWidget *widget); static gboolean vte_button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data); static gboolean vte_keyrelease(GtkWidget *widget, GdkEventKey *event, gpointer data); static gboolean vte_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data); @@ -300,16 +347,7 @@ event->state & GDK_CONTROL_MASK && ! (event->state & GDK_SHIFT_MASK) && ! (event->state & GDK_MOD1_MASK)) { - vte_get_working_directory(); /* try to keep the working directory when restarting the VTE */ - - if (pid > 0) - { - kill(pid, SIGINT); - pid = 0; - } - vf->vte_terminal_reset(VTE_TERMINAL(widget), TRUE, TRUE); - vte_start(widget); - + vte_restart(widget); return TRUE; } return FALSE; @@ -348,14 +386,14 @@
static void vte_restart(GtkWidget *widget) { - vte_get_working_directory(); /* try to keep the working directory when restarting the VTE */ - if (pid > 0) - { - kill(pid, SIGINT); - pid = 0; - } - vf->vte_terminal_reset(VTE_TERMINAL(widget), TRUE, TRUE); - vte_start(widget); + vte_get_working_directory(); /* try to keep the working directory when restarting the VTE */ + if (pid > 0) + { + kill(pid, SIGINT); + pid = 0; + } + vf->vte_terminal_reset(VTE_TERMINAL(widget), TRUE, TRUE); + vte_start(widget); }
Modified: trunk/src/vte.h =================================================================== --- trunk/src/vte.h 2008-06-25 17:38:31 UTC (rev 2725) +++ trunk/src/vte.h 2008-06-26 16:14:00 UTC (rev 2726) @@ -89,51 +89,6 @@ gpointer user_data); */
-/* taken from original vte.h to make my life easier ;-) */ - -typedef struct _VteTerminalPrivate VteTerminalPrivate; - -typedef struct _VteTerminal VteTerminal; -struct _VteTerminal -{ - GtkWidget widget; - GtkAdjustment *adjustment; - glong char_width, char_height; - glong char_ascent, char_descent; - glong row_count, column_count; - gchar *window_title; - gchar *icon_title; - VteTerminalPrivate *pvt; -}; - - -/* store function pointers in a struct to avoid a strange segfault if they are stored directly - * if accessed directly, gdb says the segfault arrives at old_tab_width(prefs.c), don't ask me */ -struct VteFunctions -{ - GtkWidget* (*vte_terminal_new) (void); - pid_t (*vte_terminal_fork_command) (VteTerminal *terminal, const char *command, char **argv, - char **envv, const char *directory, gboolean lastlog, - gboolean utmp, gboolean wtmp); - void (*vte_terminal_set_size) (VteTerminal *terminal, glong columns, glong rows); - void (*vte_terminal_set_word_chars) (VteTerminal *terminal, const char *spec); - void (*vte_terminal_set_mouse_autohide) (VteTerminal *terminal, gboolean setting); - void (*vte_terminal_reset) (VteTerminal *terminal, gboolean full, gboolean clear_history); - GtkType (*vte_terminal_get_type) (void); - void (*vte_terminal_set_scroll_on_output) (VteTerminal *terminal, gboolean scroll); - void (*vte_terminal_set_scroll_on_keystroke) (VteTerminal *terminal, gboolean scroll); - void (*vte_terminal_set_font_from_string) (VteTerminal *terminal, const char *name); - void (*vte_terminal_set_scrollback_lines) (VteTerminal *terminal, glong lines); - gboolean (*vte_terminal_get_has_selection) (VteTerminal *terminal); - void (*vte_terminal_copy_clipboard) (VteTerminal *terminal); - void (*vte_terminal_paste_clipboard) (VteTerminal *terminal); - void (*vte_terminal_set_emulation) (VteTerminal *terminal, const gchar *emulation); - void (*vte_terminal_set_color_foreground) (VteTerminal *terminal, const GdkColor *foreground); - void (*vte_terminal_set_color_background) (VteTerminal *terminal, const GdkColor *background); - void (*vte_terminal_feed_child) (VteTerminal *terminal, const char *data, glong length); - void (*vte_terminal_im_append_menuitems) (VteTerminal *terminal, GtkMenuShell *menushell); -}; - #endif
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.