[gnome-mud] Resize Patch
- From: Les Harris <lescom comcast net>
- To: gnome-mud-list gnome org
- Subject: [gnome-mud] Resize Patch
- Date: Tue, 27 Dec 2005 19:49:33 -0800
Here is a patch that allows us to properly resize the gnome-mud window
taking into account the VTE widgets inside of it (ie, they will properly
update their rows/columns a la GNOME Terminal)
Les
__ PATCH FOLLOWS __
? resize.patch
Index: src/mud-connection-view.c
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/mud-connection-view.c,v
retrieving revision 1.3
diff -u -u -r1.3 mud-connection-view.c
--- src/mud-connection-view.c 20 Dec 2005 11:36:18 -0000 1.3
+++ src/mud-connection-view.c 28 Dec 2005 03:46:17 -0000
@@ -13,8 +13,12 @@
static char const rcsid[] = "$Id: ";
+GtkWidget *gWindow;
+
struct _MudConnectionViewPrivate
{
+ GtkWidget *window;
+
GtkWidget *terminal;
GtkWidget *scrollbar;
GtkWidget *box;
@@ -271,9 +275,15 @@
mud_connection_view_init (MudConnectionView *connection_view)
{
GtkWidget *box;
+ GdkGeometry hints;
+ gint xpad, ypad;
+ gint char_width, char_height;
connection_view->priv = g_new0(MudConnectionViewPrivate, 1);
//FIXME connection_view->priv->prefs = mud_preferences_new(NULL);
+ connection_view->priv->window = gWindow;
+ gWindow = NULL;
+
box = gtk_hbox_new(FALSE, 0);
connection_view->priv->terminal = vte_terminal_new();
@@ -288,7 +298,28 @@
connection_view->priv->scrollbar = gtk_vscrollbar_new(NULL);
gtk_range_set_adjustment(GTK_RANGE(connection_view->priv->scrollbar),
VTE_TERMINAL(connection_view->priv->terminal)->adjustment);
gtk_box_pack_start(GTK_BOX(box), connection_view->priv->scrollbar,
FALSE, FALSE, 0);
-
+
+ /* Let us resize the gnome-mud window */
+
vte_terminal_get_padding(VTE_TERMINAL(connection_view->priv->terminal),
&xpad, &ypad);
+ char_width =
VTE_TERMINAL(connection_view->priv->terminal)->char_width;
+ char_height =
VTE_TERMINAL(connection_view->priv->terminal)->char_height;
+
+ hints.base_width = xpad;
+ hints.base_height = ypad;
+ hints.width_inc = char_width;
+ hints.height_inc = char_height;
+
+ hints.min_width = hints.base_width + hints.width_inc * 4;
+ hints.min_height = hints.base_height+ hints.height_inc * 2;
+
+
+
gtk_window_set_geometry_hints(GTK_WINDOW(connection_view->priv->window),
+ GTK_WIDGET(connection_view->priv->terminal),
+ &hints,
+ GDK_HINT_RESIZE_INC |
+ GDK_HINT_MIN_SIZE |
+ GDK_HINT_BASE_SIZE);
+
gtk_widget_show_all(box);
g_object_set_data(G_OBJECT(box), "connection-view", connection_view);
@@ -596,10 +627,12 @@
}
MudConnectionView*
-mud_connection_view_new (const gchar *profile, const gchar *hostname,
const gint port)
+mud_connection_view_new (const gchar *profile, const gchar *hostname,
const gint port, GtkWidget *window)
{
MudConnectionView *view;
+ gWindow = window;
+
g_assert(hostname != NULL);
g_assert(port > 0);
Index: src/mud-connection-view.h
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/mud-connection-view.h,v
retrieving revision 1.2
diff -u -u -r1.2 mud-connection-view.h
--- src/mud-connection-view.h 15 Sep 2005 07:36:25 -0000 1.2
+++ src/mud-connection-view.h 28 Dec 2005 03:46:17 -0000
@@ -41,7 +41,7 @@
GType mud_connection_view_get_type (void) G_GNUC_CONST;
-MudConnectionView* mud_connection_view_new (const gchar *profile, const
gchar *hostname, const gint port);
+MudConnectionView* mud_connection_view_new (const gchar *profile, const
gchar *hostname, const gint port, GtkWidget *window);
GtkWidget* mud_connection_view_get_viewport (MudConnectionView *view);
void mud_connection_view_disconnect (MudConnectionView *view);
void mud_connection_view_reconnect (MudConnectionView *view);
Index: src/mud-window-mconnect.c
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/mud-window-mconnect.c,v
retrieving revision 1.2
diff -u -u -r1.2 mud-window-mconnect.c
--- src/mud-window-mconnect.c 27 Dec 2005 14:22:28 -0000 1.2
+++ src/mud-window-mconnect.c 28 Dec 2005 03:46:17 -0000
@@ -46,6 +46,7 @@
};
MudWindow *window;
+GtkWidget *gwinwidget;
GType mud_mconnect_window_get_type (void);
static void mud_mconnect_window_init (MudMConnectWindow *preferences);
@@ -214,7 +215,7 @@
if(mconnect->priv->SelPort < 1)
mconnect->priv->SelPort = 23;
- mconnect->priv->view = mud_connection_view_new("Default",
mconnect->priv->SelHost, mconnect->priv->SelPort);
+ mconnect->priv->view = mud_connection_view_new("Default",
mconnect->priv->SelHost, mconnect->priv->SelPort, gwinwidget);
mud_window_add_connection_view(window, mconnect->priv->view);
if(mconnect->priv->SelConnect)
@@ -295,11 +296,12 @@
// Instantiate MudMConnectWindow
MudMConnectWindow*
-mud_window_mconnect_new(MudWindow *win)
+mud_window_mconnect_new(MudWindow *win, GtkWidget *winwidget)
{
MudMConnectWindow *MudMConnect;
window = win;
+ gwinwidget = winwidget;
MudMConnect = g_object_new(MUD_TYPE_MCONNECT_WINDOW, NULL);
Index: src/mud-window-mconnect.h
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/mud-window-mconnect.h,v
retrieving revision 1.1
diff -u -u -r1.1 mud-window-mconnect.h
--- src/mud-window-mconnect.h 27 Dec 2005 12:45:23 -0000 1.1
+++ src/mud-window-mconnect.h 28 Dec 2005 03:46:17 -0000
@@ -30,7 +30,7 @@
GType mud_connect_window_get_type (void) G_GNUC_CONST;
-MudMConnectWindow *mud_window_mconnect_new(MudWindow *win);
+MudMConnectWindow *mud_window_mconnect_new(MudWindow *win, GtkWidget
*winwidget);
G_END_DECLS
Index: src/mud-window.c
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/mud-window.c,v
retrieving revision 1.4
diff -u -u -r1.4 mud-window.c
--- src/mud-window.c 27 Dec 2005 14:22:28 -0000 1.4
+++ src/mud-window.c 28 Dec 2005 03:46:18 -0000
@@ -143,7 +143,11 @@
static void
mud_window_mconnect_dialog(GtkWidget *widget, MudWindow *window)
{
- mud_window_mconnect_new(window);
+ GtkWidget *mywig;
+
+ mywig = window->priv->window;
+
+ mud_window_mconnect_new(window, mywig);
}
static void
@@ -184,7 +188,7 @@
iport = 23;
}
- view = mud_connection_view_new("Default", host, iport);
+ view = mud_connection_view_new("Default", host, iport,
window->priv->window);
mud_window_add_connection_view(window, view);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]