[gnome-mud] Port to GTK3
- From: Mart Raudsepp <mraudsepp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mud] Port to GTK3
- Date: Fri, 4 Jan 2019 00:36:31 +0000 (UTC)
commit 33d40c082130e24e1f642cbf1a76667a777c357f
Author: Mart Raudsepp <leio gentoo org>
Date: Fri Jan 4 02:28:51 2019 +0200
Port to GTK3
Some noticable regressions in this quick port that remain:
* MUD Input box automatic resize isn't working
* (ZMP) subwindow size forcing doesn't work for now due to VTE deprecations
having gone away completely and not having looked for replacement yet
* Some compilation warnings (other than deprecations) may be leftover to
sort through; some of them might trigger crashes at runtime
Of course lots of deprecation warnings too now, but now we actually have
the proper replacements available at our fingertips.
configure.ac | 6 +-
data/prefs.ui | 254 ++++++++++-------------------------------
src/debug-logger.c | 18 +--
src/handlers/mud-telnet-naws.c | 8 +-
src/mud-connection-view.c | 52 +++------
src/mud-connection-view.h | 2 +-
src/mud-log.c | 37 +++---
src/mud-profile.c | 49 ++++----
src/mud-profile.h | 49 ++++----
src/mud-subwindow.c | 43 ++++---
src/mud-window-prefs.c | 178 +++++++++--------------------
src/mud-window.c | 35 +++---
src/utils.c | 2 +-
13 files changed, 257 insertions(+), 476 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 00de11f..d3e12d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,13 +64,13 @@ dnl gsettings
GLIB_GSETTINGS
dnl pkg-config dep checks
-GTK_REQUIRED=2.24.0
+GTK_REQUIRED=3.4
LIBGLIB_REQUIRED=2.48
-VTE_REQUIRED=0.11.00
+VTE_REQUIRED=0.37
PCRE_REQUIRED=6.0.0
GSTREAMER_REQUIRED=1.0
-PKG_CHECK_MODULES(GMUD, gtk+-2.0 >= $GTK_REQUIRED vte >= $VTE_REQUIRED libpcre >= $PCRE_REQUIRED gio-2.0 >=
$LIBGLIB_REQUIRED)
+PKG_CHECK_MODULES(GMUD, gtk+-3.0 >= $GTK_REQUIRED vte-2.91 >= $VTE_REQUIRED libpcre >= $PCRE_REQUIRED
gio-2.0 >= $LIBGLIB_REQUIRED)
AC_SUBST(GMUD_CFLAGS)
AC_SUBST(GMUD_LIBS)
diff --git a/data/prefs.ui b/data/prefs.ui
index e1afa1a..dfb4d07 100644
--- a/data/prefs.ui
+++ b/data/prefs.ui
@@ -9,184 +9,6 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
- <object class="GtkListStore" id="model1">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0">ISO-8859-1</col>
- </row>
- <row>
- <col id="0">ISO-8859-2</col>
- </row>
- <row>
- <col id="0">ISO-8859-3</col>
- </row>
- <row>
- <col id="0">ISO-8859-4</col>
- </row>
- <row>
- <col id="0">ISO-8859-5</col>
- </row>
- <row>
- <col id="0">ISO-8859-6</col>
- </row>
- <row>
- <col id="0">ISO-8859-7</col>
- </row>
- <row>
- <col id="0">ISO-8859-8</col>
- </row>
- <row>
- <col id="0">ISO-8859-9</col>
- </row>
- <row>
- <col id="0">ISO-8859-10</col>
- </row>
- <row>
- <col id="0">ISO-8859-11</col>
- </row>
- <row>
- <col id="0">ISO-8859-12</col>
- </row>
- <row>
- <col id="0">ISO-8859-13</col>
- </row>
- <row>
- <col id="0">ISO-8859-14</col>
- </row>
- <row>
- <col id="0">ISO-8859-15</col>
- </row>
- <row>
- <col id="0">ISO-8859-16</col>
- </row>
- <row>
- <col id="0">UTF-8</col>
- </row>
- <row>
- <col id="0">ARMSCII-8</col>
- </row>
- <row>
- <col id="0">BIG5</col>
- </row>
- <row>
- <col id="0">BIG5-HKSCS</col>
- </row>
- <row>
- <col id="0">CP866</col>
- </row>
- <row>
- <col id="0">EUC-JP</col>
- </row>
- <row>
- <col id="0">EUC-KR</col>
- </row>
- <row>
- <col id="0">EUC-TW</col>
- </row>
- <row>
- <col id="0">GB18030</col>
- </row>
- <row>
- <col id="0">GB2312</col>
- </row>
- <row>
- <col id="0">GBK</col>
- </row>
- <row>
- <col id="0">GEORGIAN-PS</col>
- </row>
- <row>
- <col id="0">IBM850</col>
- </row>
- <row>
- <col id="0">IBM852</col>
- </row>
- <row>
- <col id="0">IBM855</col>
- </row>
- <row>
- <col id="0">IBM857</col>
- </row>
- <row>
- <col id="0">IBM862</col>
- </row>
- <row>
- <col id="0">ISO-2022-JP</col>
- </row>
- <row>
- <col id="0">ISO-IR-111</col>
- </row>
- <row>
- <col id="0">KOI8-R</col>
- </row>
- <row>
- <col id="0">KOI8-U</col>
- </row>
- <row>
- <col id="0">MAC-CYRILLIC</col>
- </row>
- <row>
- <col id="0">SHIFT_JIS</col>
- </row>
- <row>
- <col id="0">TCVN</col>
- </row>
- <row>
- <col id="0">TIS-620</col>
- </row>
- <row>
- <col id="0">UHC</col>
- </row>
- <row>
- <col id="0">VISCII</col>
- </row>
- <row>
- <col id="0">WINDOWS-1250</col>
- </row>
- <row>
- <col id="0">WINDOWS-1251</col>
- </row>
- <row>
- <col id="0">WINDOWS-1252</col>
- </row>
- <row>
- <col id="0">WINDOWS-1253</col>
- </row>
- <row>
- <col id="0">WINDOWS-1254</col>
- </row>
- <row>
- <col id="0">WINDOWS-1255</col>
- </row>
- <row>
- <col id="0">WINDOWS-1256</col>
- </row>
- <row>
- <col id="0">WINDOWS-1257</col>
- </row>
- <row>
- <col id="0">WINDOWS-1258</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="model2">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0">4</col>
- </row>
- <row>
- <col id="0">5</col>
- </row>
- </data>
- </object>
<object class="GtkDialog" id="newprofile_dialog">
<property name="visible">False</property>
<property name="can_focus">False</property>
@@ -514,16 +336,63 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="encoding_combo">
+ <object class="GtkComboBoxText" id="encoding_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="model">model1</property>
- <child>
- <object class="GtkCellRendererText" id="renderer1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <items>
+ <item id="ISO-8859-1">ISO-8859-1</item>
+ <item id="ISO-8859-2">ISO-8859-2</item>
+ <item id="ISO-8859-3">ISO-8859-3</item>
+ <item id="ISO-8859-4">ISO-8859-4</item>
+ <item id="ISO-8859-5">ISO-8859-5</item>
+ <item id="ISO-8859-6">ISO-8859-6</item>
+ <item id="ISO-8859-7">ISO-8859-7</item>
+ <item id="ISO-8859-8">ISO-8859-8</item>
+ <item id="ISO-8859-9">ISO-8859-9</item>
+ <item id="ISO-8859-10">ISO-8859-10</item>
+ <item id="ISO-8859-11">ISO-8859-11</item>
+ <item id="ISO-8859-12">ISO-8859-12</item>
+ <item id="ISO-8859-13">ISO-8859-13</item>
+ <item id="ISO-8859-14">ISO-8859-14</item>
+ <item id="ISO-8859-15">ISO-8859-15</item>
+ <item id="ISO-8859-16">ISO-8859-16</item>
+ <item id="UTF-8">UTF-8</item>
+ <item id="ARMSCII-8">ARMSCII-8</item>
+ <item id="BIG5">BIG5</item>
+ <item id="BIG5-HKSCS">BIG5-HKSCS</item>
+ <item id="CP866">CP866</item>
+ <item id="EUC-JP">EUC-JP</item>
+ <item id="EUC-KR">EUC-KR</item>
+ <item id="EUC-TW">EUC-TW</item>
+ <item id="GB18030">GB18030</item>
+ <item id="GB2312">GB2312</item>
+ <item id="GBK">GBK</item>
+ <item id="GEORGIAN-PS">GEORGIAN-PS</item>
+ <item id="IBM850">IBM850</item>
+ <item id="IBM852">IBM852</item>
+ <item id="IBM855">IBM855</item>
+ <item id="IBM857">IBM857</item>
+ <item id="IBM862">IBM862</item>
+ <item id="ISO-2022-JP">ISO-2022-JP</item>
+ <item id="ISO-IR-111">ISO-IR-111</item>
+ <item id="KOI8-R">KOI8-R</item>
+ <item id="KOI8-U">KOI8-U</item>
+ <item id="MAC-CYRILLIC">MAC-CYRILLIC</item>
+ <item id="SHIFT_JIS">SHIFT_JIS</item>
+ <item id="TCVN">TCVN</item>
+ <item id="TIS-620">TIS-620</item>
+ <item id="UHC">UHC</item>
+ <item id="VISCII">VISCII</item>
+ <item id="WINDOWS-1250">WINDOWS-1250</item>
+ <item id="WINDOWS-1251">WINDOWS-1251</item>
+ <item id="WINDOWS-1252">WINDOWS-1252</item>
+ <item id="WINDOWS-1253">WINDOWS-1253</item>
+ <item id="WINDOWS-1254">WINDOWS-1254</item>
+ <item id="WINDOWS-1255">WINDOWS-1255</item>
+ <item id="WINDOWS-1256">WINDOWS-1256</item>
+ <item id="WINDOWS-1257">WINDOWS-1257</item>
+ <item id="WINDOWS-1258">WINDOWS-1258</item>
+ </items>
</object>
<packing>
<property name="expand">True</property>
@@ -1245,17 +1114,14 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="proxy_combo">
+ <object class="GtkComboBoxText" id="proxy_combo">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="model">model2</property>
- <child>
- <object class="GtkCellRendererText" id="renderer2"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <items>
+ <item id="4">4</item>
+ <item id="5">5</item>
+ </items>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/src/debug-logger.c b/src/debug-logger.c
index f1752e7..65771ac 100644
--- a/src/debug-logger.c
+++ b/src/debug-logger.c
@@ -34,7 +34,7 @@
struct _DebugLoggerPrivate
{
- GtkVBox *vbox;
+ GtkBox *vbox;
GtkWindow *window;
GtkNotebook *notebook;
@@ -975,7 +975,7 @@ debug_logger_create_domain_page(DebugLogger *logger,
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
- GtkHBox *hbox;
+ GtkBox *hbox;
GtkImage *image;
g_return_if_fail(IS_DEBUG_LOGGER(logger));
@@ -1017,17 +1017,19 @@ debug_logger_create_domain_page(DebugLogger *logger,
gtk_container_add(GTK_CONTAINER(scrolled_window), treeview);
- hbox = GTK_HBOX(gtk_hbox_new(FALSE, 0));
+ hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
image = GTK_IMAGE(gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU));
- gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(image), FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), tab_label, TRUE, TRUE, 0);
+ gtk_box_pack_start(hbox, GTK_WIDGET(image), FALSE, FALSE, 0);
+ gtk_box_pack_start(hbox, tab_label, TRUE, TRUE, 0);
gtk_widget_show_all(GTK_WIDGET(hbox));
gtk_notebook_append_page(logger->priv->notebook, scrolled_window, GTK_WIDGET(hbox));
- gtk_notebook_set_tab_label_packing(logger->priv->notebook, scrolled_window,
- TRUE, TRUE, GTK_PACK_START);
+ gtk_container_child_set(GTK_CONTAINER(logger->priv->notebook), scrolled_window,
+ "tab-expand", TRUE,
+ "tab-fill", TRUE,
+ NULL);
gtk_widget_show_all(GTK_WIDGET(logger->priv->notebook));
@@ -1066,7 +1068,7 @@ debug_logger_create_window(DebugLogger *self)
g_bytes_unref (res_bytes);
self->priv->window = GTK_WINDOW(gtk_builder_get_object(builder, "log_window"));
- self->priv->vbox = GTK_VBOX(gtk_builder_get_object(builder, "vbox"));
+ self->priv->vbox = GTK_BOX(gtk_builder_get_object(builder, "vbox"));
self->priv->toolbar_save = GTK_WIDGET(gtk_builder_get_object(builder, "toolbar_save"));
self->priv->toolbar_copy = GTK_WIDGET(gtk_builder_get_object(builder, "toolbar_copy"));
self->priv->toolbar_select = GTK_WIDGET(gtk_builder_get_object(builder, "toolbar_selectall"));
diff --git a/src/handlers/mud-telnet-naws.c b/src/handlers/mud-telnet-naws.c
index 13c0067..180e6db 100644
--- a/src/handlers/mud-telnet-naws.c
+++ b/src/handlers/mud-telnet-naws.c
@@ -282,8 +282,8 @@ mud_telnet_naws_enable(MudTelnetHandler *handler)
self);
mud_telnet_naws_send(self,
- terminal->column_count,
- terminal->row_count);
+ vte_terminal_get_column_count (terminal),
+ vte_terminal_get_row_count (terminal));
g_log("Telnet", G_LOG_LEVEL_INFO, "%s", "NAWS Enabled");
}
@@ -345,8 +345,8 @@ mud_telnet_naws_resized_cb(MudWindow *window,
if(self->priv->enabled && mud_connection_is_connected(view->conn))
mud_telnet_naws_send(self,
- view->terminal->column_count,
- view->terminal->row_count);
+ vte_terminal_get_column_count (view->terminal),
+ vte_terminal_get_row_count (view->terminal));
}
/* Private Methods */
diff --git a/src/mud-connection-view.c b/src/mud-connection-view.c
index 32a64a8..52f1ce9 100644
--- a/src/mud-connection-view.c
+++ b/src/mud-connection-view.c
@@ -160,8 +160,6 @@ static void mud_connection_view_reread_profile(MudConnectionView *view);
static void mud_connection_view_feed_text(MudConnectionView *view,
gchar *message);
-static void mud_connection_view_update_geometry (MudConnectionView *window);
-
#ifdef ENABLE_GST
static void mud_connection_view_download_progress_cb(goffset current_num_bytes,
goffset total_num_bytes,
@@ -346,7 +344,7 @@ mud_connection_view_class_init (MudConnectionViewClass *klass)
g_param_spec_object("ui-vbox",
"ui vbox",
"main ui vbox",
- GTK_TYPE_VBOX,
+ GTK_TYPE_BOX,
G_PARAM_READABLE));
}
@@ -470,7 +468,6 @@ mud_connection_view_constructor (GType gtype,
guint n_properties,
GObjectConstructParam *properties)
{
- GtkWidget *box;
#ifdef ENABLE_GST
GtkWidget *dl_vbox;
GtkWidget *dl_hbox;
@@ -515,16 +512,15 @@ mud_connection_view_constructor (GType gtype,
}
/* Create main VBox, VTE, and scrollbar */
- box = gtk_vbox_new(FALSE, 0);
- self->ui_vbox = GTK_VBOX(box);
+ self->ui_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
self->terminal = VTE_TERMINAL(vte_terminal_new()); /* TODO: Set up autowrap, so things rewrap on resize
(this will be the default once we upgrade VTE to some gtk3 version); make sure none of our own tracking of
things gets messed up from that, though */
- self->priv->scrollbar = gtk_vscrollbar_new(NULL);
- term_box = gtk_hbox_new(FALSE, 0);
+ self->priv->scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, gtk_scrollable_get_vadjustment
(GTK_SCROLLABLE (self->terminal)));
+ term_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
#ifdef ENABLE_GST
/* Setup Download UI */
- dl_vbox = gtk_vbox_new(FALSE, 0);
- dl_hbox = gtk_hbox_new(FALSE, 0);
+ dl_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ dl_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
self->priv->dl_label = gtk_label_new(_("Downloading…"));
self->priv->progressbar = gtk_progress_bar_new();
@@ -538,7 +534,7 @@ mud_connection_view_constructor (GType gtype,
gtk_box_pack_end(GTK_BOX(dl_vbox), dl_hbox, TRUE, TRUE, 0);
/* Pack into Main UI */
- gtk_box_pack_start(GTK_BOX(box), dl_vbox, FALSE, FALSE, 0);
+ gtk_box_pack_start(self->ui_vbox, dl_vbox, FALSE, FALSE, 0);
/* Set defaults and create download queue */
self->priv->downloading = FALSE;
@@ -565,7 +561,7 @@ mud_connection_view_constructor (GType gtype,
0);
/* Pack into Main UI */
- gtk_box_pack_end(GTK_BOX(box), term_box, TRUE, TRUE, 0);
+ gtk_box_pack_end(self->ui_vbox, term_box, TRUE, TRUE, 0);
/* Connect signals and set data */
g_signal_connect(G_OBJECT(self->terminal),
@@ -576,18 +572,14 @@ mud_connection_view_constructor (GType gtype,
g_object_set_data(G_OBJECT(self->terminal),
"connection-view",
self);
- g_object_set_data(G_OBJECT(box),
+ g_object_set_data(G_OBJECT(self->ui_vbox),
"connection-view",
self);
- /* Setup scrollbar */
- gtk_range_set_adjustment(
- GTK_RANGE(self->priv->scrollbar),
- self->terminal->adjustment);
-
/* Setup VTE */
- vte_terminal_set_encoding(self->terminal, "ISO-8859-1");
- vte_terminal_set_emulation(self->terminal, "xterm");
+ vte_terminal_set_encoding(self->terminal, "ISO-8859-1", NULL); /* TODO: This is deprecated; if keeping,
at least add error handling? */
+ /* TODO: set_emulation doesn't exist anymore. We don't really care, but does it affect TTYPE queries? */
+ /* vte_terminal_set_emulation(self->terminal, "xterm"); */
vte_terminal_set_cursor_shape(self->terminal,
VTE_CURSOR_SHAPE_UNDERLINE);
@@ -637,9 +629,9 @@ mud_connection_view_constructor (GType gtype,
g_free(proxy_uri);
/* Show everything */
- gtk_widget_show_all(box);
+ gtk_widget_show_all(self->ui_vbox);
- mud_connection_view_update_geometry (self);
+ /* TODO: Reimplement and call - mud_connection_view_update_geometry (self); */
#ifdef ENABLE_GST
/* Hide UI until download starts */
@@ -1032,7 +1024,6 @@ mud_connection_view_button_press_event(GtkWidget *widget, GdkEventButton *event,
static void
mud_connection_view_popup(MudConnectionView *view, GdkEventButton *event)
{
- GtkWidget *im_menu;
GtkWidget *menu_item;
GtkWidget *profile_menu;
GSequence *profiles;
@@ -1104,16 +1095,6 @@ mud_connection_view_popup(MudConnectionView *view, GdkEventButton *event)
(GDestroyNotify) g_object_unref);
}
- menu_item = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
-
- im_menu = gtk_menu_new();
- menu_item = gtk_menu_item_new_with_mnemonic(_("_Input Methods"));
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), im_menu);
- vte_terminal_im_append_menuitems(view->terminal,
- GTK_MENU_SHELL(im_menu));
- gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
-
gtk_widget_show_all(view->priv->popup_menu);
gtk_menu_popup(GTK_MENU(view->priv->popup_menu),
NULL, NULL,
@@ -1246,6 +1227,8 @@ popup_menu_detach(GtkWidget *widget, GtkMenu *menu)
}
/* Private Methods */
+#if 0
+#warning Reimplement
static void
mud_connection_view_update_geometry (MudConnectionView *window)
{
@@ -1283,6 +1266,7 @@ mud_connection_view_update_geometry (MudConnectionView *window)
GDK_HINT_MIN_SIZE |
GDK_HINT_BASE_SIZE);
}
+#endif
static GtkWidget*
append_stock_menuitem(GtkWidget *menu, const gchar *text, GCallback callback, gpointer data)
@@ -1661,7 +1645,7 @@ mud_connection_view_add_text(MudConnectionView *view, gchar *message, enum MudCo
text = NULL;
}
- vte_terminal_set_encoding(view->terminal, encoding);
+ vte_terminal_set_encoding(view->terminal, encoding, NULL); /* TODO: This is deprecated; if keeping, at
least add error handling? */
g_free(encoding);
diff --git a/src/mud-connection-view.h b/src/mud-connection-view.h
index 11b50eb..c4b68d8 100644
--- a/src/mud-connection-view.h
+++ b/src/mud-connection-view.h
@@ -68,7 +68,7 @@ struct _MudConnectionView
MudParseBase *parse;
VteTerminal *terminal;
- GtkVBox *ui_vbox;
+ GtkBox *ui_vbox;
};
enum MudConnectionColorType
diff --git a/src/mud-log.c b/src/mud-log.c
index e81b57f..2f0df7f 100644
--- a/src/mud-log.c
+++ b/src/mud-log.c
@@ -754,10 +754,11 @@ mud_log_open(MudLog *self)
g_object_get(self->priv->parent, "terminal", &term, NULL);
clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
+ /* FIXME: Can't we get this more directly than futzing via clipboard? */
vte_terminal_select_all(term);
vte_terminal_copy_primary(term);
term_text = gtk_clipboard_wait_for_text(clipboard);
- vte_terminal_select_none(term);
+ vte_terminal_unselect_all(term);
if(term_text)
{
@@ -780,11 +781,12 @@ mud_log_open(MudLog *self)
g_object_get(self->priv->parent, "terminal", &term, NULL);
+ /* FIXME: Can we get rid of the clipboard hack with gtk3 vte? */
clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
vte_terminal_select_all(term);
vte_terminal_copy_primary(term);
term_text = gtk_clipboard_wait_for_text(clipboard);
- vte_terminal_select_none(term);
+ vte_terminal_unselect_all(term);
if(term_text)
{
@@ -1354,6 +1356,7 @@ static void
mud_log_write_html_header(MudLog *self)
{
gchar *title = g_path_get_basename(self->priv->filename);
+ gchar *color_string;
fprintf(self->priv->logfile, "%s", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fprintf(self->priv->logfile, "%s", "\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n
");
@@ -1368,15 +1371,13 @@ mud_log_write_html_header(MudLog *self)
fprintf(self->priv->logfile, "%s", "<style type=\"text/css\">\n\t\t\t");
- fprintf(self->priv->logfile, "body {\n\t\t\t\tbackground-color: rgb(%d, %d, %d);\n",
- self->priv->parent->profile->preferences->Background.red / 256,
- self->priv->parent->profile->preferences->Background.green / 256,
- self->priv->parent->profile->preferences->Background.blue / 256);
+ color_string = gdk_rgba_to_string (&self->priv->parent->profile->preferences->Background);
+ fprintf(self->priv->logfile, "body {\n\t\t\t\tbackground-color: %s;\n", color_string);
+ g_free (color_string);
- fprintf(self->priv->logfile, "\t\t\t\tcolor: rgb(%d, %d, %d);\n",
- self->priv->parent->profile->preferences->Foreground.red / 256,
- self->priv->parent->profile->preferences->Foreground.green / 256,
- self->priv->parent->profile->preferences->Foreground.blue / 256);
+ color_string = gdk_rgba_to_string (&self->priv->parent->profile->preferences->Foreground);
+ fprintf(self->priv->logfile, "\t\t\t\tcolor: %s;\n", color_string);
+ g_free (color_string);
fprintf(self->priv->logfile, "%s", "\t\t\t\tfont-family: monospace;\n");
@@ -1402,6 +1403,7 @@ mud_log_write_html_foreground_span(MudLog *self,
gboolean bold,
gint ecma_code)
{
+ gchar *color_string;
gint color_index = ecma_code - 30;
/* Work around some gnome-mud palette weirdness */
@@ -1426,10 +1428,9 @@ mud_log_write_html_foreground_span(MudLog *self,
color_index += (bold) ? 8 : 0;
- g_string_append_printf(output, "<span style=\"color: rgb(%d, %d, %d);\">",
- self->priv->parent->profile->preferences->Colors[color_index].red / 256,
- self->priv->parent->profile->preferences->Colors[color_index].blue / 256,
- self->priv->parent->profile->preferences->Colors[color_index].green / 256);
+ color_string = gdk_rgba_to_string (&self->priv->parent->profile->preferences->Colors[color_index]);
+ g_string_append_printf(output, "<span style=\"color: %s;\">", color_string);
+ g_free (color_string);
g_queue_push_head(self->priv->span_queue, GINT_TO_POINTER(ecma_code));
}
@@ -1439,6 +1440,7 @@ mud_log_write_html_background_span(MudLog *self,
gboolean bold,
gint ecma_code)
{
+ gchar *color_string;
gint color_index = ecma_code - 40;
/* Work around some gnome-mud palette weirdness */
@@ -1463,10 +1465,9 @@ mud_log_write_html_background_span(MudLog *self,
color_index += (bold) ? 8 : 0;
- g_string_append_printf(output, "<span style=\"background-color: rgb(%d, %d, %d);\">",
- self->priv->parent->profile->preferences->Colors[color_index].red / 256,
- self->priv->parent->profile->preferences->Colors[color_index].blue / 256,
- self->priv->parent->profile->preferences->Colors[color_index].green / 256);
+ color_string = gdk_rgba_to_string (&self->priv->parent->profile->preferences->Colors[color_index]);
+ g_string_append_printf(output, "<span style=\"background-color: %s;\">", color_string);
+ g_free (color_string);
g_queue_push_head(self->priv->span_queue, GINT_TO_POINTER(ecma_code));
}
diff --git a/src/mud-profile.c b/src/mud-profile.c
index 2cf0a06..1f111ca 100644
--- a/src/mud-profile.c
+++ b/src/mud-profile.c
@@ -371,7 +371,7 @@ mud_profile_load_preferences (MudProfile *profile)
MudPrefs *prefs;
gchar *color_string;
gchar **color_palette;
- GdkColor color;
+ GdkRGBA color;
/* TODO: Get rid of this - currently needed due to keeping a copy of setting values in
profile->preferences */
prefs = profile->preferences;
@@ -390,12 +390,12 @@ mud_profile_load_preferences (MudProfile *profile)
prefs->Scrollback = g_settings_get_uint (profile->settings, "scrollback-lines");
color_string = g_settings_get_string (profile->settings, "foreground-color");
- if (color_string && gdk_color_parse (color_string, &color))
+ if (color_string && gdk_rgba_parse (&color, color_string))
prefs->Foreground = color;
g_free (color_string);
color_string = g_settings_get_string (profile->settings, "background-color");
- if (color_string && gdk_color_parse (color_string, &color))
+ if (color_string && gdk_rgba_parse (&color, color_string))
prefs->Background = color;
g_free (color_string);
@@ -629,7 +629,7 @@ mud_profile_set_proxy_combo_full(MudProfile *profile, gchar *version)
void
mud_profile_set_proxy_combo(MudProfile *profile, GtkComboBox *combo)
{
- gchar *version = gtk_combo_box_get_active_text(combo);
+ gchar *version = gtk_combo_box_get_active_id(combo);
mud_profile_set_proxy_combo_full(profile, version);
}
@@ -649,17 +649,17 @@ mud_profile_set_font (MudProfile *profile, const gchar *value)
}
void
-mud_profile_set_foreground (MudProfile *profile, GdkColor *color)
+mud_profile_set_foreground (MudProfile *profile, GdkRGBA *color)
{
- gchar *s = gdk_color_to_string(color);
+ gchar *s = gdk_rgba_to_string(color);
g_settings_set_string(profile->settings, "foreground-color", s);
g_free(s);
}
void
-mud_profile_set_background (MudProfile *profile, GdkColor *color)
+mud_profile_set_background (MudProfile *profile, GdkRGBA *color)
{
- gchar *s = gdk_color_to_string(color);
+ gchar *s = gdk_rgba_to_string(color);
g_settings_set_string(profile->settings, "background-color", s);
g_free(s);
}
@@ -667,10 +667,10 @@ mud_profile_set_background (MudProfile *profile, GdkColor *color)
void
mud_profile_set_colors (MudProfile *profile,
gint nr,
- GdkColor *color)
+ GdkRGBA *color)
{
gchar **value;
- gchar *s = gdk_color_to_string (color);
+ gchar *s = gdk_rgba_to_string (color);
/* FIXME: Guard against retrieved old value not having 16 entries */
value = g_settings_get_strv (profile->settings, "palette");
g_free (value[nr]); /* FIXME: Guard against wrong 'nr' value */
@@ -689,16 +689,13 @@ mud_profile_set_scrollback(MudProfile *profile, const guint value)
static gboolean
set_Foreground(MudProfile *profile, const gchar *candidate)
{
- GdkColor color;
+ GdkRGBA color;
- if (candidate && gdk_color_parse(candidate, &color))
+ if (candidate && gdk_rgba_parse(&color, candidate))
{
- if (!gdk_color_equal(&color, &profile->priv->preferences.Foreground))
+ if (!gdk_rgba_equal(&color, &profile->priv->preferences.Foreground))
{
- profile->priv->preferences.Foreground.red = color.red;
- profile->priv->preferences.Foreground.green = color.green;
- profile->priv->preferences.Foreground.blue = color.blue;
-
+ profile->priv->preferences.Foreground = color;
return TRUE;
}
}
@@ -709,16 +706,13 @@ set_Foreground(MudProfile *profile, const gchar *candidate)
static gboolean
set_Background(MudProfile *profile, const gchar *candidate)
{
- GdkColor color;
+ GdkRGBA color;
- if (candidate && gdk_color_parse(candidate, &color))
+ if (candidate && gdk_rgba_parse(&color, candidate))
{
- if (!gdk_color_equal(&color, &profile->priv->preferences.Background))
+ if (!gdk_rgba_equal(&color, &profile->priv->preferences.Background))
{
- profile->priv->preferences.Background.red = color.red;
- profile->priv->preferences.Background.green = color.green;
- profile->priv->preferences.Background.blue = color.blue;
-
+ profile->priv->preferences.Background = color;
return TRUE;
}
}
@@ -730,7 +724,7 @@ static gboolean
set_Colors (MudProfile *profile, gchar **palette)
{
guint n_colors = (palette == NULL) ? 0 : g_strv_length (palette);
- GdkColor colors[C_MAX];
+ GdkRGBA colors[C_MAX];
if ((palette == NULL) || (n_colors < C_MAX))
{
@@ -743,10 +737,9 @@ set_Colors (MudProfile *profile, gchar **palette)
}
for (gsize i = 0; i < C_MAX; ++i)
- if (!gdk_color_parse (palette[i], &colors[i]))
+ if (!gdk_rgba_parse (&colors[i], palette[i]))
return FALSE;
- memcpy(profile->priv->preferences.Colors, &colors, C_MAX * sizeof(GdkColor));
+ memcpy(profile->priv->preferences.Colors, &colors, C_MAX * sizeof(GdkRGBA));
return TRUE;
}
-
diff --git a/src/mud-profile.h b/src/mud-profile.h
index 65fc00c..b7b3683 100644
--- a/src/mud-profile.h
+++ b/src/mud-profile.h
@@ -2,6 +2,7 @@
* mud-profile.h
* Copyright (C) 1998-2005 Robin Ericsson <lobbin localhost nu>
* Copyright (C) 2005-2009 Les Harris <lharris gnome org>
+ * Copytight (C) 2019 Mart Raudsepp <leio gentoo org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,38 +44,38 @@ typedef struct _MudPrefs MudPrefs;
struct _MudPrefs
{
- gboolean EchoText;
- gboolean KeepText;
- gboolean ScrollOnOutput;
+ gboolean EchoText;
+ gboolean KeepText;
+ gboolean ScrollOnOutput;
- gchar *FontName;
- gchar *CommDev;
- gchar *Encoding;
- gchar *ProxyVersion;
- gchar *ProxyHostname;
+ gchar *FontName;
+ gchar *CommDev;
+ gchar *Encoding;
+ gchar *ProxyVersion;
+ gchar *ProxyHostname;
- guint Scrollback;
+ guint Scrollback;
- GdkColor Foreground;
- GdkColor Background;
+ GdkRGBA Foreground;
+ GdkRGBA Background;
- gboolean UseRemoteEncoding;
- gboolean UseProxy;
- gboolean UseRemoteDownload;
+ gboolean UseRemoteEncoding;
+ gboolean UseProxy;
+ gboolean UseRemoteDownload;
- GdkColor Colors[C_MAX];
+ GdkRGBA Colors[C_MAX];
};
struct _MudProfile
{
- GObject parent_instance;
+ GObject parent_instance;
- MudProfilePrivate *priv;
+ MudProfilePrivate *priv;
- guint64 id;
- gchar *visible_name;
- GSettings *settings;
- MudPrefs *preferences;
+ guint64 id;
+ gchar *visible_name;
+ GSettings *settings;
+ MudPrefs *preferences;
};
typedef struct
@@ -116,9 +117,9 @@ void mud_profile_set_scrolloutput (MudProfile *profile, gboolean value);
void mud_profile_set_commdev (MudProfile *profile, const gchar *value);
void mud_profile_set_scrollback (MudProfile *profile, const guint value);
void mud_profile_set_font (MudProfile *profile, const gchar *value);
-void mud_profile_set_foreground (MudProfile *profile, GdkColor *color);
-void mud_profile_set_background (MudProfile *profile, GdkColor *color);
-void mud_profile_set_colors (MudProfile *profile, gint nr, GdkColor *color);
+void mud_profile_set_foreground (MudProfile *profile, GdkRGBA *color);
+void mud_profile_set_background (MudProfile *profile, GdkRGBA *color);
+void mud_profile_set_colors (MudProfile *profile, gint nr, GdkRGBA *color);
void mud_profile_set_encoding_combo(MudProfile *profile, const gchar *value);
void mud_profile_set_encoding_check (MudProfile *profile, gboolean value);
void mud_profile_set_proxy_check (MudProfile *profile, const gboolean value);
diff --git a/src/mud-subwindow.c b/src/mud-subwindow.c
index 2315570..ff9759b 100644
--- a/src/mud-subwindow.c
+++ b/src/mud-subwindow.c
@@ -152,7 +152,6 @@ static void mud_subwindow_set_size_force_grid (MudSubwindow *window,
const gchar *mud_subwindow_get_history_item(MudSubwindow *self,
enum MudSubwindowHistoryDirection direction);
-static void mud_subwindow_update_geometry (MudSubwindow *window);
static void mud_subwindow_set_terminal_colors(MudSubwindow *self);
static void mud_subwindow_set_terminal_scrollback(MudSubwindow *self);
static void mud_subwindow_set_terminal_scrolloutput(MudSubwindow *self);
@@ -411,20 +410,20 @@ mud_subwindow_constructor (GType gtype,
gtk_window_set_transient_for(GTK_WINDOW(self->priv->window),
GTK_WINDOW(main_window));
- self->priv->vbox = gtk_vbox_new(FALSE, 0);
+ self->priv->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
self->priv->entry = gtk_entry_new();
gtk_widget_hide(self->priv->entry);
self->priv->terminal = vte_terminal_new();
- self->priv->scrollbar = gtk_vscrollbar_new(NULL);
- term_box = gtk_hbox_new(FALSE, 0);
+ self->priv->scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, gtk_scrollable_get_vadjustment
(GTK_SCROLLABLE (self->priv->terminal)));
+ term_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
vte_terminal_set_encoding(VTE_TERMINAL(self->priv->terminal),
- "ISO-8859-1");
+ "ISO-8859-1", NULL); /* TODO: This is deprecated; if keeping, at least add
error handling? */
- vte_terminal_set_emulation(VTE_TERMINAL(self->priv->terminal),
- "xterm");
+ /* TODO: set_emulation doesn't exist anymore. We don't really care, but does it affect TTYPE queries? */
+ /* vte_terminal_set_emulation(VTE_TERMINAL(self->priv->terminal), "xterm"); */
vte_terminal_set_cursor_shape(VTE_TERMINAL(self->priv->terminal),
VTE_CURSOR_SHAPE_UNDERLINE);
@@ -452,10 +451,6 @@ mud_subwindow_constructor (GType gtype,
gtk_box_pack_end(GTK_BOX(self->priv->vbox), self->priv->entry, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(self->priv->window), self->priv->vbox);
- gtk_range_set_adjustment(
- GTK_RANGE(self->priv->scrollbar),
- VTE_TERMINAL(self->priv->terminal)->adjustment);
-
gtk_window_set_title(GTK_WINDOW(self->priv->window), self->priv->title);
gtk_widget_show(term_box);
@@ -800,6 +795,9 @@ mud_subwindow_set_size_force_grid (MudSubwindow *window,
int force_grid_width,
int force_grid_height)
{
+ /* TODO: Missing get_padding in new VTE; maybe we can just use vte_terminal_set_size? */
+#if 0
+#warning Reimplement mud_subwindow size forcing
/* Owen's hack from gnome-terminal */
GtkWidget *widget;
GtkWidget *app;
@@ -827,11 +825,11 @@ mud_subwindow_set_size_force_grid (MudSubwindow *window,
w = toplevel_request.width - widget_request.width;
h = toplevel_request.height - widget_request.height;
- char_width = VTE_TERMINAL(screen)->char_width;
- char_height = VTE_TERMINAL(screen)->char_height;
+ char_width = vte_terminal_get_char_width (screen);
+ char_height = vte_terminal_get_char_height (screen);
- grid_width = VTE_TERMINAL(screen)->column_count;
- grid_height = VTE_TERMINAL(screen)->row_count;
+ grid_width = vte_terminal_get_column_count (screen);
+ grid_height = vte_terminal_get_row_count (screen);
if (force_grid_width >= 0)
grid_width = force_grid_width;
@@ -859,8 +857,8 @@ mud_subwindow_update_geometry (MudSubwindow *window)
if(gtk_widget_get_mapped(window->priv->window))
{
- char_width = VTE_TERMINAL(widget)->char_width;
- char_height = VTE_TERMINAL(widget)->char_height;
+ char_width = vte_terminal_get_char_width (VTE_TERMINAL(widget));
+ char_height = vte_terminal_get_char_height (VTE_TERMINAL(widget));
vte_terminal_get_padding (VTE_TERMINAL (window->priv->terminal), &xpad, &ypad);
@@ -884,6 +882,7 @@ mud_subwindow_update_geometry (MudSubwindow *window)
GDK_HINT_MIN_SIZE |
GDK_HINT_BASE_SIZE);
}
+#endif
}
/* MudSubwindow Callbacks */
@@ -931,8 +930,8 @@ mud_subwindow_size_allocate_cb(GtkWidget *widget,
if(self->priv->width != allocation->width ||
self->priv->height != allocation->height)
{
- self->priv->width = VTE_TERMINAL(self->priv->terminal)->column_count;
- self->priv->height = VTE_TERMINAL(self->priv->terminal)->row_count;
+ self->priv->width = vte_terminal_get_column_count (VTE_TERMINAL (self->priv->terminal));
+ self->priv->height = vte_terminal_get_row_count (VTE_TERMINAL(self->priv->terminal));
g_signal_emit(self,
mud_subwindow_signal[RESIZED],
@@ -963,7 +962,7 @@ mud_subwindow_entry_keypress_cb(GtkWidget *widget,
{
const gchar *history;
- if ((event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) &&
+ if ((event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter) &&
(event->state & gtk_accelerator_get_default_mod_mask()) == 0 &&
gtk_widget_get_mapped(self->priv->entry) )
{
@@ -999,7 +998,7 @@ mud_subwindow_entry_keypress_cb(GtkWidget *widget,
return TRUE;
}
- if(event->keyval == GDK_Up)
+ if(event->keyval == GDK_KEY_Up)
{
history =
mud_subwindow_get_history_item(self,
@@ -1014,7 +1013,7 @@ mud_subwindow_entry_keypress_cb(GtkWidget *widget,
return TRUE;
}
- if(event->keyval == GDK_Down)
+ if(event->keyval == GDK_KEY_Down)
{
history =
mud_subwindow_get_history_item(self,
diff --git a/src/mud-window-prefs.c b/src/mud-window-prefs.c
index e2468a9..97f3324 100644
--- a/src/mud-window-prefs.c
+++ b/src/mud-window-prefs.c
@@ -591,39 +591,10 @@ mud_window_prefs_update_scrolloutput(MudWindowPrefs *self,
}
static void
-mud_window_prefs_update_encoding_combo(MudWindowPrefs *self,
- MudPrefs *preferences)
+mud_window_prefs_update_encoding_combo (MudWindowPrefs *self,
+ MudPrefs *preferences)
{
- GtkTreeModel *encodings =
- gtk_combo_box_get_model(GTK_COMBO_BOX(self->priv->encoding_combo));
- GtkTreeIter iter;
- gboolean valid;
- gint count = 0;
-
- valid = gtk_tree_model_get_iter_first(encodings, &iter);
-
- if(!preferences->Encoding)
- return;
-
- while(valid)
- {
- gchar *encoding;
-
- gtk_tree_model_get(encodings, &iter, 0, &encoding, -1);
-
- if(!encoding)
- continue;
-
- if(g_str_equal(encoding, preferences->Encoding))
- break;
-
- count++;
-
- valid = gtk_tree_model_iter_next(encodings, &iter);
- }
-
- gtk_combo_box_set_active(GTK_COMBO_BOX(self->priv->encoding_combo),
- count);
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (self->priv->encoding_combo), preferences->Encoding);
}
static void
@@ -651,56 +622,38 @@ mud_window_prefs_update_scrollback(MudWindowPrefs *self,
}
static void
-mud_window_prefs_update_font(MudWindowPrefs *self,
- MudPrefs *preferences)
+mud_window_prefs_update_font (MudWindowPrefs *self,
+ MudPrefs *preferences)
{
- gtk_font_button_set_font_name(GTK_FONT_BUTTON(self->priv->font_button),
- preferences->FontName);
+ gtk_font_button_set_font_name (GTK_FONT_BUTTON (self->priv->font_button),
+ preferences->FontName);
}
static void
-mud_window_prefs_update_foreground(MudWindowPrefs *self,
- MudPrefs *preferences)
+mud_window_prefs_update_foreground (MudWindowPrefs *self,
+ MudPrefs *preferences)
{
- GdkColor color;
-
- color.red = preferences->Foreground.red;
- color.green = preferences->Foreground.green;
- color.blue = preferences->Foreground.blue;
-
- gtk_color_button_set_color(GTK_COLOR_BUTTON(self->priv->fore_button),
- &color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (self->priv->fore_button),
+ &preferences->Foreground);
}
static void
-mud_window_prefs_update_background(MudWindowPrefs *self,
- MudPrefs *preferences)
+mud_window_prefs_update_background (MudWindowPrefs *self,
+ MudPrefs *preferences)
{
- GdkColor color;
-
- color.red = preferences->Background.red;
- color.green = preferences->Background.green;
- color.blue = preferences->Background.blue;
-
- gtk_color_button_set_color(GTK_COLOR_BUTTON(self->priv->back_button),
- &color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (self->priv->back_button),
+ &preferences->Background);
}
static void
-mud_window_prefs_update_colors(MudWindowPrefs *self,
- MudPrefs *preferences)
+mud_window_prefs_update_colors (MudWindowPrefs *self,
+ MudPrefs *preferences)
{
- gint i;
- GdkColor color;
-
- for (i = 0; i < C_MAX; i++)
+ gint i;
+ for (i = 0; i < C_MAX; i++)
{
- color.red = preferences->Colors[i].red;
- color.green = preferences->Colors[i].green;
- color.blue = preferences->Colors[i].blue;
-
- gtk_color_button_set_color(GTK_COLOR_BUTTON(self->priv->colors[i]),
- &color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (self->priv->colors[i]),
+ &preferences->Colors[i]);
}
}
@@ -709,7 +662,7 @@ static void
mud_window_prefs_scrolloutput_cb(GtkWidget *widget,
MudWindowPrefs *self)
{
- gboolean value = GTK_TOGGLE_BUTTON(widget)->active ? TRUE : FALSE;
+ gboolean value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
RETURN_IF_CHANGING_PROFILES(self);
mud_profile_set_scrolloutput(self->priv->mud_profile, value);
@@ -719,7 +672,7 @@ static void
mud_window_prefs_keeptext_cb(GtkWidget *widget,
MudWindowPrefs *self)
{
- gboolean value = GTK_TOGGLE_BUTTON(widget)->active ? TRUE : FALSE;
+ gboolean value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
RETURN_IF_CHANGING_PROFILES(self);
mud_profile_set_keeptext(self->priv->mud_profile, value);
@@ -729,7 +682,7 @@ static void
mud_window_prefs_echo_cb(GtkWidget *widget,
MudWindowPrefs *self)
{
- gboolean value = GTK_TOGGLE_BUTTON(widget)->active ? TRUE : FALSE;
+ gboolean value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
RETURN_IF_CHANGING_PROFILES(self);
mud_profile_set_echotext(self->priv->mud_profile, value);
@@ -747,13 +700,13 @@ mud_window_prefs_commdev_cb(GtkWidget *widget,
}
static void
-mud_window_prefs_encoding_combo_cb(GtkWidget *widget,
- MudWindowPrefs *self)
+mud_window_prefs_encoding_combo_cb (GtkWidget *widget,
+ MudWindowPrefs *self)
{
- const gchar *s = gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget));
- RETURN_IF_CHANGING_PROFILES(self);
+ const gchar *s = gtk_combo_box_get_active_id (GTK_COMBO_BOX (widget));
+ RETURN_IF_CHANGING_PROFILES (self);
- mud_profile_set_encoding_combo(self->priv->mud_profile, s);
+ mud_profile_set_encoding_combo (self->priv->mud_profile, s);
}
static void
@@ -778,44 +731,44 @@ mud_window_prefs_font_cb(GtkWidget *widget,
}
static void
-mud_window_prefs_foreground_cb(GtkWidget *widget,
- MudWindowPrefs *self)
+mud_window_prefs_foreground_cb (GtkWidget *widget,
+ MudWindowPrefs *self)
{
- GdkColor color;
+ GdkRGBA color;
- RETURN_IF_CHANGING_PROFILES(self);
+ RETURN_IF_CHANGING_PROFILES(self);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), &color);
- mud_profile_set_foreground(self->priv->mud_profile, &color);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color);
+ mud_profile_set_foreground (self->priv->mud_profile, &color);
}
static void
-mud_window_prefs_background_cb(GtkWidget *widget,
- MudWindowPrefs *self)
+mud_window_prefs_background_cb (GtkWidget *widget,
+ MudWindowPrefs *self)
{
- GdkColor color;
+ GdkRGBA color;
- RETURN_IF_CHANGING_PROFILES(self);
+ RETURN_IF_CHANGING_PROFILES(self);
- gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), &color);
- mud_profile_set_background(self->priv->mud_profile, &color);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color);
+ mud_profile_set_background (self->priv->mud_profile, &color);
}
static void
mud_window_prefs_colors_cb(GtkWidget *widget,
MudWindowPrefs *self)
{
- gint i;
- GdkColor color;
+ gint i;
+ GdkRGBA color;
- RETURN_IF_CHANGING_PROFILES(self);
+ RETURN_IF_CHANGING_PROFILES (self);
- for (i = 0; i < C_MAX; i++)
+ for (i = 0; i < C_MAX; i++)
{
- if (widget == self->priv->colors[i])
+ if (widget == self->priv->colors[i])
{
- gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), &color);
- mud_profile_set_colors(self->priv->mud_profile, i, &color);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color);
+ mud_profile_set_colors (self->priv->mud_profile, i, &color);
}
}
}
@@ -878,31 +831,12 @@ mud_window_prefs_update_msp_check(MudWindowPrefs *self,
}
static void
-mud_window_prefs_update_proxy_combo(MudWindowPrefs *self,
- MudPrefs *preferences)
+mud_window_prefs_update_proxy_combo (MudWindowPrefs *self,
+ MudPrefs *preferences)
{
- gchar *version;
- gint active;
- gint current;
-
- version = g_settings_get_string(self->priv->mud_profile->settings, "proxy-socks-version");
-
- if(version)
- {
- current = gtk_combo_box_get_active(GTK_COMBO_BOX(self->priv->proxy_combo));
-
- if(strcmp(version,"4") == 0)
- active = 0;
- else
- active = 1;
-
-
- if(current != active)
- gtk_combo_box_set_active(GTK_COMBO_BOX(self->priv->proxy_combo),
- active);
- }
-
- g_free(version);
+ gchar *version = g_settings_get_string(self->priv->mud_profile->settings, "proxy-socks-version");
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (self->priv->proxy_combo), version);
+ g_free(version);
}
static void
@@ -920,7 +854,7 @@ static void
mud_window_prefs_encoding_check_cb(GtkWidget *widget,
MudWindowPrefs *self)
{
- gboolean value = GTK_TOGGLE_BUTTON(widget)->active ? TRUE : FALSE;
+ gboolean value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
RETURN_IF_CHANGING_PROFILES(self);
mud_profile_set_encoding_check(self->priv->mud_profile, value);
@@ -930,7 +864,7 @@ static void
mud_window_prefs_proxy_check_cb(GtkWidget *widget,
MudWindowPrefs *self)
{
- gboolean value = GTK_TOGGLE_BUTTON(widget)->active ? TRUE : FALSE;
+ gboolean value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
gtk_widget_set_sensitive(self->priv->proxy_entry, value);
gtk_widget_set_sensitive(self->priv->proxy_combo, value);
@@ -944,7 +878,7 @@ static void
mud_window_prefs_msp_check_cb(GtkWidget *widget,
MudWindowPrefs *self)
{
- gboolean value = GTK_TOGGLE_BUTTON(widget)->active ? TRUE : FALSE;
+ gboolean value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
RETURN_IF_CHANGING_PROFILES(self);
mud_profile_set_msp_check(self->priv->mud_profile, value);
diff --git a/src/mud-window.c b/src/mud-window.c
index 1542270..abaa3c2 100644
--- a/src/mud-window.c
+++ b/src/mud-window.c
@@ -398,7 +398,7 @@ mud_window_init (MudWindow *self)
gtk_widget_set_size_request(self->priv->textview, -1,
self->priv->textview_line_height*1);
gtk_widget_set_size_request(
- GTK_SCROLLED_WINDOW(self->priv->textviewscroll)->vscrollbar,
+ gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(self->priv->textviewscroll)),
-1, 1);
if (gtk_widget_get_visible(self->priv->textviewscroll))
@@ -590,7 +590,7 @@ mud_window_textview_keypress(GtkWidget *widget, GdkEventKey *event, MudWindow *s
GtkTextIter start, end;
MudParseBase *base;
- if ((event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) &&
+ if ((event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter) &&
(event->state & gtk_accelerator_get_default_mod_mask()) == 0)
{
gtk_text_buffer_get_bounds(buffer, &start, &end);
@@ -622,7 +622,7 @@ mud_window_textview_keypress(GtkWidget *widget, GdkEventKey *event, MudWindow *s
if(self->priv->current_view)
{
- if(event->keyval == GDK_Up)
+ if(event->keyval == GDK_KEY_Up)
{
history =
mud_connection_view_get_history_item(self->priv->current_view,
@@ -638,7 +638,7 @@ mud_window_textview_keypress(GtkWidget *widget, GdkEventKey *event, MudWindow *s
return TRUE;
}
- if(event->keyval == GDK_Down)
+ if(event->keyval == GDK_KEY_Down)
{
history =
mud_connection_view_get_history_item(self->priv->current_view,
@@ -665,7 +665,7 @@ mud_window_entry_keypress(GtkWidget *widget,
{
const gchar *text;
- if ((event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) &&
+ if ((event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter) &&
(event->state & gtk_accelerator_get_default_mod_mask()) == 0)
{
if (self->priv->current_view)
@@ -933,11 +933,12 @@ mud_window_buffer_cb(GtkWidget *widget, MudWindow *self)
/* This is really hackish but the only alternative,
* vte_terminal_get_text_range, is just broken. */
+ /* FIXME: Re-evaluate for gtk3 vte */
clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
vte_terminal_select_all(term);
vte_terminal_copy_primary(term);
- vte_terminal_select_none(term);
+ vte_terminal_unselect_all(term);
buffer_text = gtk_clipboard_wait_for_text(clipboard);
if(buffer_text)
@@ -1259,8 +1260,8 @@ mud_window_add_connection_view(MudWindow *self, GObject *cview, gchar *tabLbl)
{
gint nr;
VteTerminal *terminal;
- GtkVBox *viewport;
- GtkHBox *hbox;
+ GtkBox *viewport;
+ GtkBox *hbox;
GtkWidget *tab_label;
GtkImage *image, *close_image;
GtkButton *close_button;
@@ -1281,7 +1282,7 @@ mud_window_add_connection_view(MudWindow *self, GObject *cview, gchar *tabLbl)
NULL);
tab_label = gtk_label_new(tabLbl);
- hbox = GTK_HBOX(gtk_hbox_new(FALSE, 0));
+ hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
image = GTK_IMAGE(gtk_image_new_from_icon_name(GMUD_STOCK_NEGATIVE,
GTK_ICON_SIZE_MENU));
@@ -1291,9 +1292,9 @@ mud_window_add_connection_view(MudWindow *self, GObject *cview, gchar *tabLbl)
gtk_button_set_relief(close_button, GTK_RELIEF_NONE);
gtk_button_set_image(close_button, GTK_WIDGET(close_image));
- gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(image), FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), tab_label, TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(close_button), FALSE, FALSE, 0);
+ gtk_box_pack_start(hbox, GTK_WIDGET(image), FALSE, FALSE, 0);
+ gtk_box_pack_start(hbox, tab_label, TRUE, TRUE, 0);
+ gtk_box_pack_start(hbox, GTK_WIDGET(close_button), FALSE, FALSE, 0);
gtk_widget_show_all(GTK_WIDGET(hbox));
@@ -1301,11 +1302,11 @@ mud_window_add_connection_view(MudWindow *self, GObject *cview, gchar *tabLbl)
GTK_WIDGET(viewport),
GTK_WIDGET(hbox));
- gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(self->priv->notebook),
- GTK_WIDGET(viewport),
- TRUE,
- TRUE,
- GTK_PACK_START);
+ gtk_container_child_set(GTK_CONTAINER(self->priv->notebook),
+ GTK_WIDGET(viewport),
+ "tab-expand", TRUE,
+ "tab-fill", TRUE,
+ NULL);
gtk_notebook_set_current_page(GTK_NOTEBOOK(self->priv->notebook), nr);
diff --git a/src/utils.c b/src/utils.c
index 51e41c9..b9c630f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -130,7 +130,7 @@ utils_error_message(GtkWidget *parent, const gchar *title, const gchar *fmt, ...
icon = gtk_image_new_from_icon_name("gtk-dialog-error", GTK_ICON_SIZE_DIALOG);
hbox = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]