Remove unused gtk-prefs project

This commit is contained in:
TingPing 2013-09-29 02:49:55 -04:00
parent 00bd389cdc
commit 247d84fbd1
15 changed files with 0 additions and 2422 deletions

View File

@ -1,69 +0,0 @@
/* HexChat
* Copyright (c) 2011-2012 Berke Viktor.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <windows.h>
#include "hexchat-plugin.h"
static hexchat_plugin *ph; /* plugin handle */
static void
launch_tool ()
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory (&si, sizeof (si));
si.cb = sizeof (si);
ZeroMemory (&pi, sizeof (pi));
if (!CreateProcess ( NULL, "gtk2-prefs.exe", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
hexchat_print (ph, "Error launching the GTK+ Preference Tool! Maybe the executable is missing?");
}
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
}
int
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
{
ph = plugin_handle;
*plugin_name = "GTKPref";
*plugin_desc = "GTK+ Preference Tool Launcher";
*plugin_version = "1.0";
hexchat_hook_command (ph, "GTKPREF", HEXCHAT_PRI_NORM, launch_tool, 0, 0);
hexchat_command (ph, "MENU -ietc\\gtkpref.png ADD \"Settings/GTK+ Preferences\" \"GTKPREF\"");
return 1; /* return 1 for success */
}
int
hexchat_plugin_deinit (void)
{
hexchat_command (ph, "MENU DEL \"Settings/GTK+ Preferences\"");
return 1;
}

View File

@ -1,18 +0,0 @@
include "..\..\src\makeinc.mak"
all: gtkpref.obj gtkpref.def
link $(LDFLAGS) $(LIBS) /dll /out:xcgtkpref.dll /def:gtkpref.def gtkpref.obj
gtkpref.def:
echo EXPORTS > gtkpref.def
echo hexchat_plugin_init >> gtkpref.def
echo hexchat_plugin_deinit >> gtkpref.def
gtkpref.obj: gtkpref.c makefile.mak
cl $(CFLAGS) $(GLIB) /I.. gtkpref.c
clean:
del *.obj
del *.dll
del *.exp
del *.lib

View File

@ -1,242 +0,0 @@
/* GTK+ Preference Tool
* Copyright (C) 2003-2005 Alex Shaduri.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include <iostream>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include "main.h"
extern GtkWidget* g_main_window;
void
on_main_showpreviewtoggle_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
if (gtk_toggle_button_get_active (togglebutton)) {
gtk_widget_show(lookup_widget(g_main_window, "main_previewhbox"));
gtk_button_set_label(GTK_BUTTON(togglebutton), "Hide preview <<");
gtk_window_resize(GTK_WINDOW(g_main_window), 700, 330);
} else {
gtk_widget_hide(lookup_widget(g_main_window, "main_previewhbox"));
gtk_button_set_label(GTK_BUTTON(togglebutton), "Show preview >>");
gtk_window_resize(GTK_WINDOW(g_main_window), 300, 330);
}
}
/*
extern GtkWidget* g_fontsel_dialog;
void
on_fontsel_dialog_response (GtkDialog *dialog,
gint id,
gpointer user_data)
{
switch(id) {
case GTK_RESPONSE_OK:
{
const char* font = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG(dialog));
std::string f = (font ? font : "");
set_theme(get_selected_theme(), f);
break;
}
// case GTK_RESPONSE_CANCEL:
// gtk_widget_destroy(g_fontsel_dialog);
// g_fontsel_dialog = 0;
// return;
}
gtk_widget_destroy(g_fontsel_dialog);
g_fontsel_dialog = 0;
}
gboolean
on_fontsel_dialog_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
gtk_widget_destroy(g_fontsel_dialog);
g_fontsel_dialog = 0;
return FALSE;
}
void
on_main_fontselectbutton_clicked (GtkButton *button,
gpointer user_data)
{
g_fontsel_dialog = create_fontsel_dialog();
gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(g_fontsel_dialog), get_current_font().c_str());
gtk_widget_show(g_fontsel_dialog);
}
*/
void
on_main_ok_button_clicked (GtkButton *button,
gpointer user_data)
{
if (save_current_theme())
gtk_main_quit();
}
void
on_main_cancel_button_clicked (GtkButton *button,
gpointer user_data)
{
gtk_main_quit();
}
void
on_main_reset_button_clicked (GtkButton *button,
gpointer user_data)
{
set_theme(get_orig_theme(), get_orig_font());
}
gboolean
on_main_window_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
program_shutdown();
return true;
}
void
on_main_use_default_font_radio_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
bool default_font = gtk_toggle_button_get_active(togglebutton);
gtk_widget_set_sensitive(lookup_widget(g_main_window, "main_font_selector_button"), !default_font);
apply_theme(get_selected_theme(), get_selected_font());
}
void
on_main_font_selector_button_font_set (GtkFontButton *fontbutton,
gpointer user_data)
{
apply_theme(get_selected_theme(), get_selected_font());
}
void
on_new2_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
void
on_open2_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
void
on_save2_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
void
on_save_as2_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
void
on_quit2_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
void
on_cut2_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
void
on_copy2_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
void
on_paste2_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
void
on_delete2_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}
void
on_about2_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
}

View File

@ -1,89 +0,0 @@
/* GTK+ Preference Tool
* Copyright (C) 2003-2005 Alex Shaduri.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <gtk/gtk.h>
void
on_main_showpreviewtoggle_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_main_ok_button_clicked (GtkButton *button,
gpointer user_data);
void
on_main_cancel_button_clicked (GtkButton *button,
gpointer user_data);
void
on_main_reset_button_clicked (GtkButton *button,
gpointer user_data);
gboolean
on_main_window_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
void
on_main_use_default_font_radio_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_main_font_selector_button_font_set (GtkFontButton *fontbutton,
gpointer user_data);
void
on_new2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_open2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_save2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_save_as2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_quit2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_cut2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_copy2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_paste2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_delete2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_about2_activate (GtkMenuItem *menuitem,
gpointer user_data);

View File

@ -1,77 +0,0 @@
/* GTK+ Preference Tool
* Copyright (C) 2003-2005 Alex Shaduri.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* For gmessages.h error message */
#define G_HAVE_ISO_VARARGS
/* For mkdir */
#define HAVE_DIRECT_H 1
/* Name of package */
#define PACKAGE gtk2-prefs
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#define PACKAGE_NAME gtk2-prefs
/* Define to the full name and version of this package. */
#define PACKAGE_STRING gtk2-prefs 0.4.1
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME gtk2-prefs
/* Define to the version of this package. */
#define PACKAGE_VERSION 0.4.1
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION 0.4.1

View File

@ -1,836 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <stdio.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
g_object_set_data (G_OBJECT (component), name, widget)
GtkWidget*
create_main_window (void)
{
GtkWidget *main_window;
GtkWidget *main_hbox;
GtkWidget *vbox1;
GtkWidget *hbox1;
GtkWidget *frame2;
GtkWidget *alignment3;
GtkWidget *scrolledwindow3;
GtkWidget *main_themelist;
GtkWidget *label1234;
GtkWidget *frame3;
GtkWidget *alignment4;
GtkWidget *vbox7;
GtkWidget *hbox8;
GtkWidget *vbox9;
GtkWidget *main_use_default_font_radio;
GSList *main_use_default_font_radio_group = NULL;
GtkWidget *main_use_custom_font_radio;
GtkWidget *alignment5;
GtkWidget *vbox10;
GtkWidget *hbox9;
GtkWidget *vbox11;
GtkWidget *main_font_selector_button;
GtkWidget *label669;
GtkWidget *vbox13;
GtkWidget *hbox6666;
GtkWidget *main_use_system_config_checkbutton;
GtkWidget *main_showpreviewtoggle;
GtkWidget *hbuttonbox1;
GtkWidget *hbox7;
GtkWidget *hbox6665;
GtkWidget *image2;
GtkWidget *label2;
GtkWidget *vbox6;
GtkWidget *hbox5;
GtkWidget *main_ok_button;
GtkWidget *main_cancel_button;
GtkWidget *main_reset_button;
GtkWidget *alignment2;
GtkWidget *hbox6;
GtkWidget *image1;
GtkWidget *label667;
GtkWidget *main_previewhbox;
GtkWidget *vseparator2;
GtkWidget *frame4;
GtkWidget *alignment6;
GtkWidget *vbox12;
GtkWidget *main_previewbook;
GtkWidget *table1;
GtkWidget *vbox2;
GtkWidget *checkbutton1;
GtkWidget *checkbutton2;
GtkWidget *button4;
GtkWidget *togglebutton1;
GtkObject *spinbutton1_adj;
GtkWidget *spinbutton1;
GtkWidget *vbox4;
GtkWidget *menubar2;
GtkWidget *menuitem5;
GtkWidget *menuitem5_menu;
GtkWidget *new2;
GtkWidget *open2;
GtkWidget *save2;
GtkWidget *save_as2;
GtkWidget *separatormenuitem2;
GtkWidget *quit2;
GtkWidget *menuitem6;
GtkWidget *menuitem6_menu;
GtkWidget *cut2;
GtkWidget *copy2;
GtkWidget *paste2;
GtkWidget *delete2;
GtkWidget *menuitem8;
GtkWidget *menuitem8_menu;
GtkWidget *about2;
GtkWidget *combobox1;
GtkWidget *comboboxentry1;
GtkWidget *hscale1;
GtkWidget *scrolledwindow1;
GtkWidget *preview_treeview;
GtkWidget *statusbar1;
GtkWidget *progressbar1;
GtkWidget *vseparator1;
GtkWidget *frame1;
GtkWidget *vbox3;
GtkWidget *radiobutton1;
GSList *radiobutton1_group = NULL;
GtkWidget *radiobutton2;
GtkWidget *radiobutton3;
GtkWidget *label6;
GtkWidget *label4;
GtkWidget *scrolledwindow2;
GtkWidget *textview1;
GtkWidget *label5;
GtkWidget *vbox5;
GtkWidget *hbox4;
GtkWidget *about_label;
GtkWidget *label666;
GtkWidget *label670;
GtkAccelGroup *accel_group;
GtkTooltips *tooltips;
tooltips = gtk_tooltips_new ();
accel_group = gtk_accel_group_new ();
main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (main_window, "main_window");
gtk_window_set_title (GTK_WINDOW (main_window), "GTK+ Preference Tool");
main_hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (main_hbox, "main_hbox");
gtk_widget_show (main_hbox);
gtk_container_add (GTK_CONTAINER (main_window), main_hbox);
gtk_widget_set_size_request (main_hbox, 310, 320);
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox1, "vbox1");
gtk_widget_show (vbox1);
gtk_box_pack_start (GTK_BOX (main_hbox), vbox1, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox1), 3);
hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox1, "hbox1");
gtk_widget_show (hbox1);
gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);
frame2 = gtk_frame_new (NULL);
gtk_widget_set_name (frame2, "frame2");
gtk_widget_show (frame2);
gtk_box_pack_start (GTK_BOX (hbox1), frame2, TRUE, TRUE, 0);
gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_NONE);
alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_set_name (alignment3, "alignment3");
gtk_widget_show (alignment3);
gtk_container_add (GTK_CONTAINER (frame2), alignment3);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 0, 0, 12, 0);
scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_name (scrolledwindow3, "scrolledwindow3");
gtk_widget_show (scrolledwindow3);
gtk_container_add (GTK_CONTAINER (alignment3), scrolledwindow3);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_SHADOW_IN);
main_themelist = gtk_tree_view_new ();
gtk_widget_set_name (main_themelist, "main_themelist");
gtk_widget_show (main_themelist);
gtk_container_add (GTK_CONTAINER (scrolledwindow3), main_themelist);
GTK_WIDGET_SET_FLAGS (main_themelist, GTK_CAN_DEFAULT);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (main_themelist), FALSE);
label1234 = gtk_label_new ("<b>Theme</b>");
gtk_widget_set_name (label1234, "label1234");
gtk_widget_show (label1234);
gtk_frame_set_label_widget (GTK_FRAME (frame2), label1234);
gtk_label_set_use_markup (GTK_LABEL (label1234), TRUE);
frame3 = gtk_frame_new (NULL);
gtk_widget_set_name (frame3, "frame3");
gtk_widget_show (frame3);
gtk_box_pack_start (GTK_BOX (vbox1), frame3, FALSE, FALSE, 9);
gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_NONE);
alignment4 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_set_name (alignment4, "alignment4");
gtk_widget_show (alignment4);
gtk_container_add (GTK_CONTAINER (frame3), alignment4);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment4), 0, 0, 12, 0);
vbox7 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox7, "vbox7");
gtk_widget_show (vbox7);
gtk_container_add (GTK_CONTAINER (alignment4), vbox7);
hbox8 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox8, "hbox8");
gtk_widget_show (hbox8);
gtk_box_pack_start (GTK_BOX (vbox7), hbox8, FALSE, FALSE, 0);
vbox9 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox9, "vbox9");
gtk_widget_show (vbox9);
gtk_box_pack_start (GTK_BOX (hbox8), vbox9, TRUE, TRUE, 0);
main_use_default_font_radio = gtk_radio_button_new_with_mnemonic (NULL, "Use theme default font");
gtk_widget_set_name (main_use_default_font_radio, "main_use_default_font_radio");
gtk_widget_show (main_use_default_font_radio);
gtk_box_pack_start (GTK_BOX (vbox9), main_use_default_font_radio, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (main_use_default_font_radio), main_use_default_font_radio_group);
main_use_default_font_radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (main_use_default_font_radio));
main_use_custom_font_radio = gtk_radio_button_new_with_mnemonic (NULL, "Use custom font:");
gtk_widget_set_name (main_use_custom_font_radio, "main_use_custom_font_radio");
gtk_widget_show (main_use_custom_font_radio);
gtk_box_pack_start (GTK_BOX (vbox9), main_use_custom_font_radio, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (main_use_custom_font_radio), main_use_default_font_radio_group);
main_use_default_font_radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (main_use_custom_font_radio));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (main_use_custom_font_radio), TRUE);
alignment5 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_set_name (alignment5, "alignment5");
gtk_widget_show (alignment5);
gtk_box_pack_start (GTK_BOX (vbox9), alignment5, TRUE, TRUE, 0);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment5), 0, 0, 12, 0);
vbox10 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox10, "vbox10");
gtk_widget_show (vbox10);
gtk_container_add (GTK_CONTAINER (alignment5), vbox10);
hbox9 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox9, "hbox9");
gtk_widget_show (hbox9);
gtk_box_pack_start (GTK_BOX (vbox10), hbox9, FALSE, FALSE, 0);
vbox11 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox11, "vbox11");
gtk_widget_show (vbox11);
gtk_box_pack_start (GTK_BOX (hbox9), vbox11, TRUE, TRUE, 0);
main_font_selector_button = gtk_font_button_new ();
gtk_widget_set_name (main_font_selector_button, "main_font_selector_button");
gtk_widget_show (main_font_selector_button);
gtk_box_pack_start (GTK_BOX (vbox11), main_font_selector_button, FALSE, FALSE, 0);
label669 = gtk_label_new ("<b>Font</b>");
gtk_widget_set_name (label669, "label669");
gtk_widget_show (label669);
gtk_frame_set_label_widget (GTK_FRAME (frame3), label669);
gtk_label_set_use_markup (GTK_LABEL (label669), TRUE);
vbox13 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox13, "vbox13");
gtk_widget_show (vbox13);
gtk_box_pack_start (GTK_BOX (vbox1), vbox13, FALSE, FALSE, 0);
hbox6666 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox6666, "hbox6666");
gtk_widget_show (hbox6666);
gtk_box_pack_start (GTK_BOX (vbox13), hbox6666, TRUE, TRUE, 0);
/* main_use_system_config_checkbutton = gtk_check_button_new_with_mnemonic ("Apply for all users");
gtk_widget_set_name (main_use_system_config_checkbutton, "main_use_system_config_checkbutton");
gtk_widget_show (main_use_system_config_checkbutton);
gtk_box_pack_start (GTK_BOX (hbox6666), main_use_system_config_checkbutton, FALSE, FALSE, 12);
gtk_tooltips_set_tip (tooltips, main_use_system_config_checkbutton, "If this is enabled, the program will update the system-wide configuration file. NOT RECOMMENDED!", NULL); */
main_showpreviewtoggle = gtk_toggle_button_new_with_mnemonic ("Show preview >>");
gtk_widget_set_name (main_showpreviewtoggle, "main_showpreviewtoggle");
gtk_widget_show (main_showpreviewtoggle);
gtk_box_pack_end (GTK_BOX (hbox6666), main_showpreviewtoggle, FALSE, FALSE, 2);
hbuttonbox1 = gtk_hbutton_box_new ();
gtk_widget_set_name (hbuttonbox1, "hbuttonbox1");
gtk_widget_show (hbuttonbox1);
gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, FALSE, FALSE, 0);
hbox7 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox7, "hbox7");
gtk_widget_show (hbox7);
gtk_box_pack_start (GTK_BOX (vbox1), hbox7, FALSE, TRUE, 6);
hbox6665 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox6665, "hbox6665");
gtk_widget_show (hbox6665);
gtk_box_pack_start (GTK_BOX (hbox7), hbox6665, TRUE, FALSE, 0);
image2 = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_widget_set_name (image2, "image2");
gtk_widget_show (image2);
gtk_box_pack_start (GTK_BOX (hbox6665), image2, FALSE, FALSE, 0);
label2 = gtk_label_new ("You should restart HexChat\nfor this change to take effect.");
gtk_widget_set_name (label2, "label2");
gtk_widget_show (label2);
gtk_box_pack_start (GTK_BOX (hbox6665), label2, FALSE, FALSE, 0);
gtk_label_set_line_wrap (GTK_LABEL (label2), TRUE);
gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
vbox6 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox6, "vbox6");
gtk_widget_show (vbox6);
gtk_box_pack_start (GTK_BOX (vbox1), vbox6, FALSE, FALSE, 0);
hbox5 = gtk_hbox_new (TRUE, 0);
gtk_widget_set_name (hbox5, "hbox5");
gtk_widget_show (hbox5);
gtk_box_pack_start (GTK_BOX (vbox6), hbox5, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox5), 4);
main_ok_button = gtk_button_new_from_stock ("gtk-ok");
gtk_widget_set_name (main_ok_button, "main_ok_button");
gtk_widget_show (main_ok_button);
gtk_box_pack_end (GTK_BOX (hbox5), main_ok_button, TRUE, TRUE, 4);
GTK_WIDGET_SET_FLAGS (main_ok_button, GTK_CAN_DEFAULT);
main_cancel_button = gtk_button_new_from_stock ("gtk-cancel");
gtk_widget_set_name (main_cancel_button, "main_cancel_button");
gtk_widget_show (main_cancel_button);
gtk_box_pack_end (GTK_BOX (hbox5), main_cancel_button, TRUE, TRUE, 4);
GTK_WIDGET_SET_FLAGS (main_cancel_button, GTK_CAN_DEFAULT);
main_reset_button = gtk_button_new ();
gtk_widget_set_name (main_reset_button, "main_reset_button");
gtk_widget_show (main_reset_button);
gtk_box_pack_end (GTK_BOX (hbox5), main_reset_button, TRUE, TRUE, 4);
alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_set_name (alignment2, "alignment2");
gtk_widget_show (alignment2);
gtk_container_add (GTK_CONTAINER (main_reset_button), alignment2);
hbox6 = gtk_hbox_new (FALSE, 2);
gtk_widget_set_name (hbox6, "hbox6");
gtk_widget_show (hbox6);
gtk_container_add (GTK_CONTAINER (alignment2), hbox6);
image1 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_BUTTON);
gtk_widget_set_name (image1, "image1");
gtk_widget_show (image1);
gtk_box_pack_start (GTK_BOX (hbox6), image1, FALSE, FALSE, 0);
label667 = gtk_label_new_with_mnemonic ("_Reset");
gtk_widget_set_name (label667, "label667");
gtk_widget_show (label667);
gtk_box_pack_start (GTK_BOX (hbox6), label667, FALSE, FALSE, 0);
main_previewhbox = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (main_previewhbox, "main_previewhbox");
gtk_box_pack_start (GTK_BOX (main_hbox), main_previewhbox, TRUE, TRUE, 0);
vseparator2 = gtk_vseparator_new ();
gtk_widget_set_name (vseparator2, "vseparator2");
gtk_widget_show (vseparator2);
gtk_box_pack_start (GTK_BOX (main_previewhbox), vseparator2, FALSE, TRUE, 4);
frame4 = gtk_frame_new (NULL);
gtk_widget_set_name (frame4, "frame4");
gtk_widget_show (frame4);
gtk_box_pack_start (GTK_BOX (main_previewhbox), frame4, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (frame4), 3);
gtk_frame_set_shadow_type (GTK_FRAME (frame4), GTK_SHADOW_NONE);
alignment6 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_set_name (alignment6, "alignment6");
gtk_widget_show (alignment6);
gtk_container_add (GTK_CONTAINER (frame4), alignment6);
vbox12 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox12, "vbox12");
gtk_widget_show (vbox12);
gtk_container_add (GTK_CONTAINER (alignment6), vbox12);
main_previewbook = gtk_notebook_new ();
gtk_widget_set_name (main_previewbook, "main_previewbook");
gtk_widget_show (main_previewbook);
gtk_box_pack_start (GTK_BOX (vbox12), main_previewbook, TRUE, TRUE, 0);
table1 = gtk_table_new (3, 3, FALSE);
gtk_widget_set_name (table1, "table1");
gtk_widget_show (table1);
gtk_container_add (GTK_CONTAINER (main_previewbook), table1);
gtk_container_set_border_width (GTK_CONTAINER (table1), 5);
vbox2 = gtk_vbox_new (FALSE, 4);
gtk_widget_set_name (vbox2, "vbox2");
gtk_widget_show (vbox2);
gtk_table_attach (GTK_TABLE (table1), vbox2, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
checkbutton1 = gtk_check_button_new_with_mnemonic ("check button 1");
gtk_widget_set_name (checkbutton1, "checkbutton1");
gtk_widget_show (checkbutton1);
gtk_box_pack_start (GTK_BOX (vbox2), checkbutton1, FALSE, FALSE, 0);
checkbutton2 = gtk_check_button_new_with_mnemonic ("check button 2");
gtk_widget_set_name (checkbutton2, "checkbutton2");
gtk_widget_show (checkbutton2);
gtk_box_pack_start (GTK_BOX (vbox2), checkbutton2, FALSE, FALSE, 0);
button4 = gtk_button_new_with_mnemonic ("button");
gtk_widget_set_name (button4, "button4");
gtk_widget_show (button4);
gtk_box_pack_start (GTK_BOX (vbox2), button4, FALSE, FALSE, 0);
togglebutton1 = gtk_toggle_button_new_with_mnemonic ("toggle button");
gtk_widget_set_name (togglebutton1, "togglebutton1");
gtk_widget_show (togglebutton1);
gtk_box_pack_start (GTK_BOX (vbox2), togglebutton1, FALSE, FALSE, 0);
spinbutton1_adj = gtk_adjustment_new (0, 0, 100, 1, 10, 10);
spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 0);
gtk_widget_set_name (spinbutton1, "spinbutton1");
gtk_widget_show (spinbutton1);
gtk_box_pack_start (GTK_BOX (vbox2), spinbutton1, FALSE, FALSE, 0);
vbox4 = gtk_vbox_new (FALSE, 4);
gtk_widget_set_name (vbox4, "vbox4");
gtk_widget_show (vbox4);
gtk_table_attach (GTK_TABLE (table1), vbox4, 2, 3, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
menubar2 = gtk_menu_bar_new ();
gtk_widget_set_name (menubar2, "menubar2");
gtk_widget_show (menubar2);
gtk_box_pack_start (GTK_BOX (vbox4), menubar2, FALSE, FALSE, 0);
menuitem5 = gtk_menu_item_new_with_mnemonic ("_File");
gtk_widget_set_name (menuitem5, "menuitem5");
gtk_widget_show (menuitem5);
gtk_container_add (GTK_CONTAINER (menubar2), menuitem5);
menuitem5_menu = gtk_menu_new ();
gtk_widget_set_name (menuitem5_menu, "menuitem5_menu");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem5), menuitem5_menu);
new2 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group);
gtk_widget_set_name (new2, "new2");
gtk_widget_show (new2);
gtk_container_add (GTK_CONTAINER (menuitem5_menu), new2);
open2 = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group);
gtk_widget_set_name (open2, "open2");
gtk_widget_show (open2);
gtk_container_add (GTK_CONTAINER (menuitem5_menu), open2);
save2 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
gtk_widget_set_name (save2, "save2");
gtk_widget_show (save2);
gtk_container_add (GTK_CONTAINER (menuitem5_menu), save2);
save_as2 = gtk_image_menu_item_new_from_stock ("gtk-save-as", accel_group);
gtk_widget_set_name (save_as2, "save_as2");
gtk_widget_show (save_as2);
gtk_container_add (GTK_CONTAINER (menuitem5_menu), save_as2);
separatormenuitem2 = gtk_separator_menu_item_new ();
gtk_widget_set_name (separatormenuitem2, "separatormenuitem2");
gtk_widget_show (separatormenuitem2);
gtk_container_add (GTK_CONTAINER (menuitem5_menu), separatormenuitem2);
gtk_widget_set_sensitive (separatormenuitem2, FALSE);
quit2 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
gtk_widget_set_name (quit2, "quit2");
gtk_widget_show (quit2);
gtk_container_add (GTK_CONTAINER (menuitem5_menu), quit2);
menuitem6 = gtk_menu_item_new_with_mnemonic ("_Edit");
gtk_widget_set_name (menuitem6, "menuitem6");
gtk_widget_show (menuitem6);
gtk_container_add (GTK_CONTAINER (menubar2), menuitem6);
menuitem6_menu = gtk_menu_new ();
gtk_widget_set_name (menuitem6_menu, "menuitem6_menu");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem6), menuitem6_menu);
cut2 = gtk_image_menu_item_new_from_stock ("gtk-cut", accel_group);
gtk_widget_set_name (cut2, "cut2");
gtk_widget_show (cut2);
gtk_container_add (GTK_CONTAINER (menuitem6_menu), cut2);
copy2 = gtk_image_menu_item_new_from_stock ("gtk-copy", accel_group);
gtk_widget_set_name (copy2, "copy2");
gtk_widget_show (copy2);
gtk_container_add (GTK_CONTAINER (menuitem6_menu), copy2);
paste2 = gtk_image_menu_item_new_from_stock ("gtk-paste", accel_group);
gtk_widget_set_name (paste2, "paste2");
gtk_widget_show (paste2);
gtk_container_add (GTK_CONTAINER (menuitem6_menu), paste2);
delete2 = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group);
gtk_widget_set_name (delete2, "delete2");
gtk_widget_show (delete2);
gtk_container_add (GTK_CONTAINER (menuitem6_menu), delete2);
menuitem8 = gtk_menu_item_new_with_mnemonic ("_Help");
gtk_widget_set_name (menuitem8, "menuitem8");
gtk_widget_show (menuitem8);
gtk_container_add (GTK_CONTAINER (menubar2), menuitem8);
menuitem8_menu = gtk_menu_new ();
gtk_widget_set_name (menuitem8_menu, "menuitem8_menu");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem8), menuitem8_menu);
about2 = gtk_menu_item_new_with_mnemonic ("_About");
gtk_widget_set_name (about2, "about2");
gtk_widget_show (about2);
gtk_container_add (GTK_CONTAINER (menuitem8_menu), about2);
combobox1 = gtk_combo_box_new_text ();
gtk_widget_set_name (combobox1, "combobox1");
gtk_widget_show (combobox1);
gtk_box_pack_start (GTK_BOX (vbox4), combobox1, FALSE, FALSE, 0);
gtk_combo_box_append_text (GTK_COMBO_BOX (combobox1), "item 1");
gtk_combo_box_append_text (GTK_COMBO_BOX (combobox1), "item 2");
gtk_combo_box_append_text (GTK_COMBO_BOX (combobox1), "item 3");
comboboxentry1 = gtk_combo_box_entry_new_text ();
gtk_widget_set_name (comboboxentry1, "comboboxentry1");
gtk_widget_show (comboboxentry1);
gtk_box_pack_start (GTK_BOX (vbox4), comboboxentry1, FALSE, FALSE, 0);
gtk_widget_set_size_request (comboboxentry1, 80, 25);
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), "item 1");
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), "item 2");
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), "item 3");
hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (15, 0, 50, 1, 0, 0)));
gtk_widget_set_name (hscale1, "hscale1");
gtk_widget_show (hscale1);
gtk_box_pack_start (GTK_BOX (vbox4), hscale1, TRUE, TRUE, 0);
gtk_scale_set_digits (GTK_SCALE (hscale1), 0);
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_name (scrolledwindow1, "scrolledwindow1");
gtk_widget_show (scrolledwindow1);
gtk_table_attach (GTK_TABLE (table1), scrolledwindow1, 2, 3, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
preview_treeview = gtk_tree_view_new ();
gtk_widget_set_name (preview_treeview, "preview_treeview");
gtk_widget_show (preview_treeview);
gtk_container_add (GTK_CONTAINER (scrolledwindow1), preview_treeview);
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (preview_treeview), TRUE);
statusbar1 = gtk_statusbar_new ();
gtk_widget_set_name (statusbar1, "statusbar1");
gtk_widget_show (statusbar1);
gtk_table_attach (GTK_TABLE (table1), statusbar1, 1, 3, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_size_request (statusbar1, 6, 20);
progressbar1 = gtk_progress_bar_new ();
gtk_widget_set_name (progressbar1, "progressbar1");
gtk_widget_show (progressbar1);
gtk_table_attach (GTK_TABLE (table1), progressbar1, 0, 1, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_size_request (progressbar1, 80, 20);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progressbar1), 0.56);
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progressbar1), "56%");
vseparator1 = gtk_vseparator_new ();
gtk_widget_set_name (vseparator1, "vseparator1");
gtk_widget_show (vseparator1);
gtk_table_attach (GTK_TABLE (table1), vseparator1, 1, 2, 0, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 5, 0);
frame1 = gtk_frame_new (NULL);
gtk_widget_set_name (frame1, "frame1");
gtk_widget_show (frame1);
gtk_table_attach (GTK_TABLE (table1), frame1, 0, 1, 1, 2,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND), 0, 0);
gtk_frame_set_label_align (GTK_FRAME (frame1), 0.5, 0.5);
vbox3 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox3, "vbox3");
gtk_widget_show (vbox3);
gtk_container_add (GTK_CONTAINER (frame1), vbox3);
gtk_container_set_border_width (GTK_CONTAINER (vbox3), 5);
radiobutton1 = gtk_radio_button_new_with_mnemonic (NULL, "radio 1");
gtk_widget_set_name (radiobutton1, "radiobutton1");
gtk_widget_show (radiobutton1);
gtk_box_pack_start (GTK_BOX (vbox3), radiobutton1, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton1), radiobutton1_group);
radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton1));
radiobutton2 = gtk_radio_button_new_with_mnemonic (NULL, "radio 2");
gtk_widget_set_name (radiobutton2, "radiobutton2");
gtk_widget_show (radiobutton2);
gtk_box_pack_start (GTK_BOX (vbox3), radiobutton2, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton2), radiobutton1_group);
radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton2));
radiobutton3 = gtk_radio_button_new_with_mnemonic (NULL, "radio 3");
gtk_widget_set_name (radiobutton3, "radiobutton3");
gtk_widget_show (radiobutton3);
gtk_box_pack_start (GTK_BOX (vbox3), radiobutton3, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton3), radiobutton1_group);
radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton3));
label6 = gtk_label_new ("frame");
gtk_widget_set_name (label6, "label6");
gtk_widget_show (label6);
gtk_frame_set_label_widget (GTK_FRAME (frame1), label6);
gtk_misc_set_padding (GTK_MISC (label6), 1, 0);
label4 = gtk_label_new ("Common widgets");
gtk_widget_set_name (label4, "label4");
gtk_widget_show (label4);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (main_previewbook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (main_previewbook), 0), label4);
scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_name (scrolledwindow2, "scrolledwindow2");
gtk_widget_show (scrolledwindow2);
gtk_container_add (GTK_CONTAINER (main_previewbook), scrolledwindow2);
textview1 = gtk_text_view_new ();
gtk_widget_set_name (textview1, "textview1");
gtk_widget_show (textview1);
gtk_container_add (GTK_CONTAINER (scrolledwindow2), textview1);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview1), GTK_WRAP_WORD);
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (textview1), 8);
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (textview1), 8);
gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview1)), "You can type some text here.\nYou can also click the right mouse button for a popup menu.", -1);
label5 = gtk_label_new ("Text area");
gtk_widget_set_name (label5, "label5");
gtk_widget_show (label5);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (main_previewbook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (main_previewbook), 1), label5);
vbox5 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox5, "vbox5");
gtk_widget_show (vbox5);
gtk_container_add (GTK_CONTAINER (main_previewbook), vbox5);
hbox4 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox4, "hbox4");
gtk_widget_show (hbox4);
gtk_box_pack_start (GTK_BOX (vbox5), hbox4, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox4), 7);
about_label = gtk_label_new ("");
gtk_widget_set_name (about_label, "about_label");
gtk_widget_show (about_label);
gtk_box_pack_start (GTK_BOX (hbox4), about_label, FALSE, FALSE, 0);
gtk_label_set_line_wrap (GTK_LABEL (about_label), TRUE);
label666 = gtk_label_new ("About");
gtk_widget_set_name (label666, "label666");
gtk_widget_show (label666);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (main_previewbook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (main_previewbook), 2), label666);
label670 = gtk_label_new ("<b>Preview</b>");
gtk_widget_set_name (label670, "label670");
gtk_widget_show (label670);
gtk_frame_set_label_widget (GTK_FRAME (frame4), label670);
gtk_label_set_use_markup (GTK_LABEL (label670), TRUE);
g_signal_connect ((gpointer) main_window, "delete_event",
G_CALLBACK (on_main_window_delete_event),
NULL);
g_signal_connect ((gpointer) main_use_default_font_radio, "toggled",
G_CALLBACK (on_main_use_default_font_radio_toggled),
NULL);
g_signal_connect ((gpointer) main_font_selector_button, "font_set",
G_CALLBACK (on_main_font_selector_button_font_set),
NULL);
g_signal_connect ((gpointer) main_showpreviewtoggle, "toggled",
G_CALLBACK (on_main_showpreviewtoggle_toggled),
NULL);
g_signal_connect ((gpointer) main_ok_button, "clicked",
G_CALLBACK (on_main_ok_button_clicked),
NULL);
g_signal_connect ((gpointer) main_cancel_button, "clicked",
G_CALLBACK (on_main_cancel_button_clicked),
NULL);
g_signal_connect ((gpointer) main_reset_button, "clicked",
G_CALLBACK (on_main_reset_button_clicked),
NULL);
g_signal_connect ((gpointer) new2, "activate",
G_CALLBACK (on_new2_activate),
NULL);
g_signal_connect ((gpointer) open2, "activate",
G_CALLBACK (on_open2_activate),
NULL);
g_signal_connect ((gpointer) save2, "activate",
G_CALLBACK (on_save2_activate),
NULL);
g_signal_connect ((gpointer) save_as2, "activate",
G_CALLBACK (on_save_as2_activate),
NULL);
g_signal_connect ((gpointer) quit2, "activate",
G_CALLBACK (on_quit2_activate),
NULL);
g_signal_connect ((gpointer) cut2, "activate",
G_CALLBACK (on_cut2_activate),
NULL);
g_signal_connect ((gpointer) copy2, "activate",
G_CALLBACK (on_copy2_activate),
NULL);
g_signal_connect ((gpointer) paste2, "activate",
G_CALLBACK (on_paste2_activate),
NULL);
g_signal_connect ((gpointer) delete2, "activate",
G_CALLBACK (on_delete2_activate),
NULL);
g_signal_connect ((gpointer) about2, "activate",
G_CALLBACK (on_about2_activate),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (main_window, main_window, "main_window");
GLADE_HOOKUP_OBJECT (main_window, main_hbox, "main_hbox");
GLADE_HOOKUP_OBJECT (main_window, vbox1, "vbox1");
GLADE_HOOKUP_OBJECT (main_window, hbox1, "hbox1");
GLADE_HOOKUP_OBJECT (main_window, frame2, "frame2");
GLADE_HOOKUP_OBJECT (main_window, alignment3, "alignment3");
GLADE_HOOKUP_OBJECT (main_window, scrolledwindow3, "scrolledwindow3");
GLADE_HOOKUP_OBJECT (main_window, main_themelist, "main_themelist");
GLADE_HOOKUP_OBJECT (main_window, label1234, "label1234");
GLADE_HOOKUP_OBJECT (main_window, frame3, "frame3");
GLADE_HOOKUP_OBJECT (main_window, alignment4, "alignment4");
GLADE_HOOKUP_OBJECT (main_window, vbox7, "vbox7");
GLADE_HOOKUP_OBJECT (main_window, hbox8, "hbox8");
GLADE_HOOKUP_OBJECT (main_window, vbox9, "vbox9");
GLADE_HOOKUP_OBJECT (main_window, main_use_default_font_radio, "main_use_default_font_radio");
GLADE_HOOKUP_OBJECT (main_window, main_use_custom_font_radio, "main_use_custom_font_radio");
GLADE_HOOKUP_OBJECT (main_window, alignment5, "alignment5");
GLADE_HOOKUP_OBJECT (main_window, vbox10, "vbox10");
GLADE_HOOKUP_OBJECT (main_window, hbox9, "hbox9");
GLADE_HOOKUP_OBJECT (main_window, vbox11, "vbox11");
GLADE_HOOKUP_OBJECT (main_window, main_font_selector_button, "main_font_selector_button");
GLADE_HOOKUP_OBJECT (main_window, label669, "label669");
GLADE_HOOKUP_OBJECT (main_window, vbox13, "vbox13");
GLADE_HOOKUP_OBJECT (main_window, hbox6666, "hbox6666");
/* GLADE_HOOKUP_OBJECT (main_window, main_use_system_config_checkbutton, "main_use_system_config_checkbutton"); */
GLADE_HOOKUP_OBJECT (main_window, main_showpreviewtoggle, "main_showpreviewtoggle");
GLADE_HOOKUP_OBJECT (main_window, hbuttonbox1, "hbuttonbox1");
GLADE_HOOKUP_OBJECT (main_window, hbox7, "hbox7");
GLADE_HOOKUP_OBJECT (main_window, hbox6665, "hbox6665");
GLADE_HOOKUP_OBJECT (main_window, image2, "image2");
GLADE_HOOKUP_OBJECT (main_window, label2, "label2");
GLADE_HOOKUP_OBJECT (main_window, vbox6, "vbox6");
GLADE_HOOKUP_OBJECT (main_window, hbox5, "hbox5");
GLADE_HOOKUP_OBJECT (main_window, main_ok_button, "main_ok_button");
GLADE_HOOKUP_OBJECT (main_window, main_cancel_button, "main_cancel_button");
GLADE_HOOKUP_OBJECT (main_window, main_reset_button, "main_reset_button");
GLADE_HOOKUP_OBJECT (main_window, alignment2, "alignment2");
GLADE_HOOKUP_OBJECT (main_window, hbox6, "hbox6");
GLADE_HOOKUP_OBJECT (main_window, image1, "image1");
GLADE_HOOKUP_OBJECT (main_window, label667, "label667");
GLADE_HOOKUP_OBJECT (main_window, main_previewhbox, "main_previewhbox");
GLADE_HOOKUP_OBJECT (main_window, vseparator2, "vseparator2");
GLADE_HOOKUP_OBJECT (main_window, frame4, "frame4");
GLADE_HOOKUP_OBJECT (main_window, alignment6, "alignment6");
GLADE_HOOKUP_OBJECT (main_window, vbox12, "vbox12");
GLADE_HOOKUP_OBJECT (main_window, main_previewbook, "main_previewbook");
GLADE_HOOKUP_OBJECT (main_window, table1, "table1");
GLADE_HOOKUP_OBJECT (main_window, vbox2, "vbox2");
GLADE_HOOKUP_OBJECT (main_window, checkbutton1, "checkbutton1");
GLADE_HOOKUP_OBJECT (main_window, checkbutton2, "checkbutton2");
GLADE_HOOKUP_OBJECT (main_window, button4, "button4");
GLADE_HOOKUP_OBJECT (main_window, togglebutton1, "togglebutton1");
GLADE_HOOKUP_OBJECT (main_window, spinbutton1, "spinbutton1");
GLADE_HOOKUP_OBJECT (main_window, vbox4, "vbox4");
GLADE_HOOKUP_OBJECT (main_window, menubar2, "menubar2");
GLADE_HOOKUP_OBJECT (main_window, menuitem5, "menuitem5");
GLADE_HOOKUP_OBJECT (main_window, menuitem5_menu, "menuitem5_menu");
GLADE_HOOKUP_OBJECT (main_window, new2, "new2");
GLADE_HOOKUP_OBJECT (main_window, open2, "open2");
GLADE_HOOKUP_OBJECT (main_window, save2, "save2");
GLADE_HOOKUP_OBJECT (main_window, save_as2, "save_as2");
GLADE_HOOKUP_OBJECT (main_window, separatormenuitem2, "separatormenuitem2");
GLADE_HOOKUP_OBJECT (main_window, quit2, "quit2");
GLADE_HOOKUP_OBJECT (main_window, menuitem6, "menuitem6");
GLADE_HOOKUP_OBJECT (main_window, menuitem6_menu, "menuitem6_menu");
GLADE_HOOKUP_OBJECT (main_window, cut2, "cut2");
GLADE_HOOKUP_OBJECT (main_window, copy2, "copy2");
GLADE_HOOKUP_OBJECT (main_window, paste2, "paste2");
GLADE_HOOKUP_OBJECT (main_window, delete2, "delete2");
GLADE_HOOKUP_OBJECT (main_window, menuitem8, "menuitem8");
GLADE_HOOKUP_OBJECT (main_window, menuitem8_menu, "menuitem8_menu");
GLADE_HOOKUP_OBJECT (main_window, about2, "about2");
GLADE_HOOKUP_OBJECT (main_window, combobox1, "combobox1");
GLADE_HOOKUP_OBJECT (main_window, comboboxentry1, "comboboxentry1");
GLADE_HOOKUP_OBJECT (main_window, hscale1, "hscale1");
GLADE_HOOKUP_OBJECT (main_window, scrolledwindow1, "scrolledwindow1");
GLADE_HOOKUP_OBJECT (main_window, preview_treeview, "preview_treeview");
GLADE_HOOKUP_OBJECT (main_window, statusbar1, "statusbar1");
GLADE_HOOKUP_OBJECT (main_window, progressbar1, "progressbar1");
GLADE_HOOKUP_OBJECT (main_window, vseparator1, "vseparator1");
GLADE_HOOKUP_OBJECT (main_window, frame1, "frame1");
GLADE_HOOKUP_OBJECT (main_window, vbox3, "vbox3");
GLADE_HOOKUP_OBJECT (main_window, radiobutton1, "radiobutton1");
GLADE_HOOKUP_OBJECT (main_window, radiobutton2, "radiobutton2");
GLADE_HOOKUP_OBJECT (main_window, radiobutton3, "radiobutton3");
GLADE_HOOKUP_OBJECT (main_window, label6, "label6");
GLADE_HOOKUP_OBJECT (main_window, label4, "label4");
GLADE_HOOKUP_OBJECT (main_window, scrolledwindow2, "scrolledwindow2");
GLADE_HOOKUP_OBJECT (main_window, textview1, "textview1");
GLADE_HOOKUP_OBJECT (main_window, label5, "label5");
GLADE_HOOKUP_OBJECT (main_window, vbox5, "vbox5");
GLADE_HOOKUP_OBJECT (main_window, hbox4, "hbox4");
GLADE_HOOKUP_OBJECT (main_window, about_label, "about_label");
GLADE_HOOKUP_OBJECT (main_window, label666, "label666");
GLADE_HOOKUP_OBJECT (main_window, label670, "label670");
GLADE_HOOKUP_OBJECT_NO_REF (main_window, tooltips, "tooltips");
gtk_widget_grab_default (main_themelist);
gtk_window_add_accel_group (GTK_WINDOW (main_window), accel_group);
return main_window;
}

View File

@ -1,5 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_main_window (void);

View File

@ -1,634 +0,0 @@
/* GTK+ Preference Tool
* Copyright (C) 2003-2005 Alex Shaduri.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/***************************************************************************
main.cpp - description
-------------------
begin : Wed Jan 1 19:06:46 GMT+4 2003
copyright : (C) 2003 - 2005 by Alex Shaduri
email : ashaduri '@' gmail.com
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <sstream>
#include <gtk/gtk.h>
#ifdef _WIN32
#include "win32util.h"
#include <io.h>
#else
#include <sys/stat.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "interface.h"
#include "callbacks.h"
#include "support.h"
#include "main.h"
// ------------------------------------------------------
GtkWidget* g_main_window = 0;
// GtkWidget* g_fontsel_dialog = 0;
static std::string s_tmp_file;
// ------------------------------------------------------
static std::string gchar_to_string(gchar* gstr)
{
std::string str = (gstr ? gstr : "");
g_free(gstr);
return str;
}
std::string get_home_dir()
{
std::string dir;
if (g_get_home_dir())
dir = g_get_home_dir();
#ifdef _WIN32
if (dir == "") {
dir = win32_get_registry_value_string(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Personal");
}
if (dir == "") {
dir = win32_get_registry_value_string(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "User");
}
#endif
return dir;
}
// ------------------------------------------------------
static std::string s_orig_theme;
static std::string s_orig_font;
std::string& get_orig_theme()
{
return s_orig_theme;
}
std::string& get_orig_font()
{
return s_orig_font;
}
// ------------------------------------------------------
std::string get_current_theme()
{
GtkSettings* settings = gtk_settings_get_default();
gchar* theme;
g_object_get(settings, "gtk-theme-name", &theme, NULL);
return gchar_to_string(theme);
}
std::string get_current_font()
{
return gchar_to_string(pango_font_description_to_string(gtk_rc_get_style(g_main_window)->font_desc));
}
// ------------------------------------------------------
std::string get_selected_theme()
{
GtkTreeView* treeview = GTK_TREE_VIEW(lookup_widget(g_main_window, "main_themelist"));
GtkTreeModel* model = gtk_tree_view_get_model(treeview);
GtkTreeSelection* selection = gtk_tree_view_get_selection(treeview);
GtkTreeIter iter;
gtk_tree_selection_get_selected(selection, 0, &iter);
gchar* theme_name;
gtk_tree_model_get(model, &iter, 0, &theme_name, -1);
// std::cout << theme_name << "\n";
return gchar_to_string(theme_name);
}
std::string get_selected_font()
{
// GtkWidget* fontentry = lookup_widget(g_main_window, "main_fontentry");
// return gtk_entry_get_text(GTK_ENTRY(fontentry));
bool default_font = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(g_main_window, "main_use_default_font_radio")));
if (default_font)
return "";
GtkWidget* fontbutton = lookup_widget(g_main_window, "main_font_selector_button");
return gtk_font_button_get_font_name(GTK_FONT_BUTTON(fontbutton));
}
// ------------------------------------------------------
static void themelist_selection_changed_cb(GtkTreeSelection* selection, gpointer data)
{
if (gtk_tree_selection_get_selected (selection, 0, 0))
apply_theme(get_selected_theme(), get_current_font());
}
// ------------------------------------------------------
static void populate_with_themes(GtkWidget* w)
{
std::string search_path = gchar_to_string(gtk_rc_get_theme_dir());
//std::string search_path = gchar_to_string(g_build_filename("lib", "gtk-2.0", "2.10.0", "engines", NULL));
if (search_path.size() && search_path[search_path.size() -1] != G_DIR_SEPARATOR)
search_path += G_DIR_SEPARATOR_S;
GDir* gdir = g_dir_open(search_path.c_str(), 0, NULL);
if (gdir == NULL)
return;
char* name;
GList* glist = 0;
while ( (name = const_cast<char*>(g_dir_read_name(gdir))) != NULL ) {
std::string filename = name;
// if (g_ascii_strup(fname.c_str(), -1) == "Default")
// continue;
std::string fullname = search_path + filename;
std::string rc = fullname; rc += G_DIR_SEPARATOR_S; rc += "gtk-2.0"; rc += G_DIR_SEPARATOR_S; rc += "gtkrc";
bool is_dir = 0;
if (g_file_test(fullname.c_str(), G_FILE_TEST_IS_DIR))
is_dir = 1;
if (is_dir && g_file_test(rc.c_str(), G_FILE_TEST_IS_REGULAR)) {
glist = g_list_insert_sorted(glist, g_strdup(filename.c_str()), (GCompareFunc)strcmp);
}
}
g_dir_close(gdir);
// ---------------- tree
GtkTreeView* treeview = GTK_TREE_VIEW(w);
GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store));
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes (
"Theme", gtk_cell_renderer_text_new(),
"text", 0,
NULL);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
GtkTreeIter iter;
int i =0, curr=0;
while (char* theme = (char*)g_list_nth_data(glist, i)) {
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, theme, -1);
if (strcmp(theme, get_current_theme().c_str()) == 0) {
curr = i;
}
++i;
}
GtkTreeSelection* selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
// set the default theme
// THIS IS IMPORTANT!!!
gtk_widget_grab_focus(w);
std::stringstream str;
str << curr;
GtkTreePath* selpath = gtk_tree_path_new_from_string (str.str().c_str());
if (selpath) {
gtk_tree_selection_select_path(selection, selpath);
gtk_tree_view_scroll_to_cell(treeview, selpath, NULL, true, 0.5, 0.0);
gtk_tree_path_free(selpath);
}
g_signal_connect (G_OBJECT (selection), "changed",
G_CALLBACK (themelist_selection_changed_cb), NULL);
g_object_unref (G_OBJECT (store));
// ---------------- font
// GtkWidget* fontentry = lookup_widget(g_main_window, "main_fontentry");
// gtk_entry_set_text(GTK_ENTRY(fontentry), get_current_font().c_str());
GtkWidget* fontbutton = lookup_widget(g_main_window, "main_font_selector_button");
gtk_font_button_set_font_name(GTK_FONT_BUTTON(fontbutton), get_current_font().c_str());
}
// ------------------------------------------------------
#ifdef _WIN32
static void redirect_to_file (const gchar* log_domain, GLogLevelFlags log_level,
const gchar* message, gpointer user_data)
{
/* only write logs if running in portable mode, otherwise
we would get a permission error in program files */
if ((_access( "portable-mode", 0 )) != -1)
{
std::fstream f;
f.open("gtk2-prefs.log", std::ios::app);
f << message << "\n";
f.close();
}
}
#endif
// ------------------------------------------------------
int main(int argc, char *argv[])
{
// work around pango weirdness
#ifdef _WIN32
// no longer needed as of pango 1.2.5, but won't do any harm
// putenv("PANGO_WIN32_NO_UNISCRIBE=1");
#endif
std::string user = g_get_user_name();
std::string tmp = g_get_tmp_dir();
std::string tmp_file = tmp + G_DIR_SEPARATOR_S + "gtk_prefs_tmprc_" + user;
s_tmp_file = tmp_file;
gtk_rc_add_default_file(tmp_file.c_str());
gtk_init (&argc, &argv);
// redirect gtk warnings to file when in win32
#if defined _WIN32 && !defined DEBUG
g_log_set_handler ("GLib", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION), redirect_to_file, NULL);
g_log_set_handler ("GModule", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION), redirect_to_file, NULL);
g_log_set_handler ("GLib-GObject", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION), redirect_to_file, NULL);
g_log_set_handler ("GThread", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION), redirect_to_file, NULL);
g_log_set_handler ("Gtk", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION), redirect_to_file, NULL);
g_log_set_handler ("Gdk", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION), redirect_to_file, NULL);
g_log_set_handler ("GdkPixbuf", GLogLevelFlags(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION), redirect_to_file, NULL);
#endif
add_pixmap_directory(".");
g_main_window = create_main_window();
populate_with_themes(lookup_widget(g_main_window, "main_themelist"));
std::string about_text = std::string("GTK+ Preference Tool") + "\n\
\n\
by Alex Shaduri <ashaduri@gmail.com>\n\
\n\
The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided \"AS IS\", and you, its user, assume the entire risk as to its quality and accuracy.\n\
\n\
This is free software, and you are welcome to redistribute it under terms of GNU General Public License v2.";
gtk_label_set_text(GTK_LABEL(lookup_widget(g_main_window, "about_label")), about_text.c_str());
GtkTreeView* treeview = GTK_TREE_VIEW(lookup_widget(g_main_window, "preview_treeview"));
GtkTreeStore *store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_INT);
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store));
GtkTreeViewColumn* column1 = gtk_tree_view_column_new_with_attributes ("Text", gtk_cell_renderer_text_new(), "text", 0, NULL);
gtk_tree_view_column_set_sizing(column1, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
gtk_tree_view_column_set_resizable(column1, true);
gtk_tree_view_column_set_reorderable (column1, true);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column1);
GtkTreeViewColumn* column2 = gtk_tree_view_column_new_with_attributes ("Number", gtk_cell_renderer_text_new(), "text", 1, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column2);
GtkTreeIter iter1, iter2;
gtk_tree_store_append (store, &iter1, NULL);
gtk_tree_store_set (store, &iter1, 0, "Parent 2", 1, 66, -1);
gtk_tree_store_append (store, &iter1, NULL);
gtk_tree_store_set (store, &iter1, 0, "Parent 1", 1, 65, -1);
gtk_tree_store_append (store, &iter2, &iter1);
gtk_tree_store_set (store, &iter2, 0, "Child 1", 1, 67, -1);
gtk_tree_view_column_set_sort_column_id(column1, 0);
gtk_tree_view_column_set_sort_order (column1, GTK_SORT_ASCENDING);
gtk_tree_view_column_set_sort_indicator(column1, true);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), 0, GTK_SORT_ASCENDING);
g_object_unref (G_OBJECT (store));
get_orig_theme() = get_current_theme();
get_orig_font() = get_current_font();
gtk_widget_show (g_main_window);
gtk_main();
return EXIT_SUCCESS;
}
// -------------------------------
void set_theme(const std::string& theme_name, const std::string& font)
{
// set widgets accordingly
// tree
GtkTreeView* treeview = GTK_TREE_VIEW(lookup_widget(g_main_window, "main_themelist"));
GtkTreeModel* model = gtk_tree_view_get_model(treeview);
GtkTreeSelection* selection = gtk_tree_view_get_selection(treeview);
GtkTreeIter iter;
gtk_tree_model_get_iter_first(model, &iter);
while(gtk_tree_model_iter_next(model, &iter)) {
gchar* text;
gtk_tree_model_get (model, &iter, 0, &text, -1);
std::string theme = gchar_to_string(text);
if (theme_name == theme) {
gtk_tree_selection_select_iter(selection, &iter);
break;
}
}
// font
// GtkWidget* fontentry = lookup_widget(g_main_window, "main_fontentry");
// gtk_entry_set_text(GTK_ENTRY(fontentry), font.c_str());
if (font != "") {
GtkWidget* fontbutton = lookup_widget(g_main_window, "main_font_selector_button");
gtk_font_button_set_font_name(GTK_FONT_BUTTON(fontbutton), get_current_font().c_str());
}
apply_theme(get_selected_theme(), get_selected_font());
}
void apply_theme(const std::string& theme_name, const std::string& font)
{
std::stringstream strstr;
strstr << "gtk-theme-name = \"" << theme_name << "\"\n";
if (font != "")
strstr << "style \"user-font\"\n{\nfont_name=\"" << font << "\"\n}\nwidget_class \"*\" style \"user-font\"";
// std::cout << strstr.str() << "\n\n\n";
std::fstream f;
f.open(s_tmp_file.c_str(), std::ios::out);
f << strstr.str();
f.close();
GtkSettings* settings = gtk_settings_get_default();
gtk_rc_reparse_all_for_settings (settings, true);
// gtk_rc_parse_string(strstr.str().c_str());
// gtk_rc_parse("/root/.gtk-tmp");
// gtk_rc_reset_styles(settings);
unlink(s_tmp_file.c_str());
while (gtk_events_pending())
gtk_main_iteration();
}
#ifdef _WIN32
#ifdef HAVE_DIRECT_H
#include <direct.h>
#define mkdir(a) _mkdir(a)
#else
#define mkdir(a, b) mkdir(a)
#endif
#endif
bool save_current_theme()
{
std::string conf_file = "";
if ((_access( "portable-mode", 0 )) != -1) {
char* themes_dir_c = gtk_rc_get_theme_dir();
char* conf_file_c = g_build_filename("etc", "gtk-2.0", "gtkrc", NULL);
conf_file = (conf_file_c ? conf_file_c : "");
// file doesn't exist, try to get it from gtk.
if (!g_file_test(conf_file.c_str(), G_FILE_TEST_EXISTS)) {
gchar** rc_files = gtk_rc_get_default_files();
if (rc_files[0] != 0) {
conf_file = rc_files[0];
}
}
g_free(themes_dir_c);
g_free(conf_file_c);
// mkdir a directory, only one level deep
char* etc = g_path_get_dirname(conf_file.c_str());
if (!g_file_test(etc, G_FILE_TEST_IS_DIR)) {
mkdir(etc, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
}
g_free(etc);
} else {
conf_file = get_home_dir();
if (conf_file[conf_file.length()-1] != G_DIR_SEPARATOR)
conf_file += G_DIR_SEPARATOR_S;
conf_file += ".gtkrc-2.0";
}
// ask
GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget* dialog = gtk_dialog_new_with_buttons ("Query", GTK_WINDOW(window),
GtkDialogFlags(GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL),
GTK_STOCK_NO, GTK_RESPONSE_REJECT,
GTK_STOCK_YES, GTK_RESPONSE_ACCEPT,
NULL);
gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
GtkWidget* hbox = gtk_hbox_new(1, 1);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 10);
gtk_container_add (GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
gtk_container_add (GTK_CONTAINER(hbox),
gtk_label_new((std::string("\n\nThe file \"") + conf_file + "\" will be overwritten.\nAre you sure?\n\n").c_str()));
gtk_widget_show_all (dialog);
bool ret = 0;
gint result = gtk_dialog_run (GTK_DIALOG (dialog));
switch (result) {
case GTK_RESPONSE_ACCEPT:
ret = 1;
break;
}
gtk_widget_destroy(dialog);
gtk_widget_destroy(window);
if (!ret) // the user pressed "No".
return false;
std::string font = get_selected_font();
std::fstream f;
f.open(conf_file.c_str(), std::ios::out);
f << "# Auto-written by gtk2_prefs. Do not edit.\n\n";
f << "gtk-theme-name = \"" << get_selected_theme() << "\"\n";
if (font != "")
f << "style \"user-font\"\n{\n\tfont_name=\"" << font << "\"\n}\nwidget_class \"*\" style \"user-font\"";
f.close();
return true;
}
void program_shutdown()
{
gtk_main_quit();
}

View File

@ -1,50 +0,0 @@
/* GTK+ Preference Tool
* Copyright (C) 2003-2005 Alex Shaduri.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/***************************************************************************
main.cpp - description
-------------------
begin : Wed Jan 1 2003
copyright : (C) 2003 - 2005 by Alex Shaduri
email : ashaduri '@' gmail.com
***************************************************************************/
#ifndef _MAIN_H_
#define _MAIN_H_
#include <string>
std::string& get_orig_theme();
std::string& get_orig_font();
std::string get_current_theme();
std::string get_current_font();
std::string get_selected_theme();
std::string get_selected_font();
void set_theme(const std::string& theme_name, const std::string& font);
void apply_theme(const std::string& theme_name, const std::string& font);
bool save_current_theme();
void program_shutdown();
#endif

View File

@ -1,24 +0,0 @@
include "..\makeinc.mak"
TARGET = gtk2-prefs.exe
PREF_OBJECTS = \
callbacks.obj \
interface.obj \
support.obj \
win32util.obj \
main.obj
CPPFLAGS = $(CPPFLAGS) /D_STL70_ /D_STATIC_CPPLIB /EHsc /DHAVE_CONFIG_H
all: $(PREF_OBJECTS) $(TARGET)
.cpp.obj:
$(CC) $(CPPFLAGS) $(GLIB) $(GTK) /I. /c $<
$(TARGET): $(PREF_OBJECTS)
$(LINK) /out:$(TARGET) /entry:mainCRTStartup $(LDFLAGS) $(PREF_OBJECTS) ntstc_msvcrt.lib $(LIBS)
clean:
del $(TARGET)
del *.obj

View File

@ -1,146 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include "support.h"
GtkWidget*
lookup_widget (GtkWidget *widget,
const gchar *widget_name)
{
GtkWidget *parent, *found_widget;
for (;;)
{
if (GTK_IS_MENU (widget))
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
else
parent = widget->parent;
if (!parent)
parent = (GtkWidget*)g_object_get_data (G_OBJECT (widget), "GladeParentKey");
if (parent == NULL)
break;
widget = parent;
}
found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
widget_name);
if (!found_widget)
g_warning ("Widget not found: %s", widget_name);
return found_widget;
}
static GList *pixmaps_directories = NULL;
/* Use this function to set the directory containing installed pixmaps. */
void
add_pixmap_directory (const gchar *directory)
{
pixmaps_directories = g_list_prepend (pixmaps_directories,
g_strdup (directory));
}
/* This is an internally used function to find pixmap files. */
static gchar*
find_pixmap_file (const gchar *filename)
{
GList *elem;
/* We step through each of the pixmaps directory to find it. */
elem = pixmaps_directories;
while (elem)
{
gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
G_DIR_SEPARATOR_S, filename);
if (g_file_test (pathname, G_FILE_TEST_EXISTS))
return pathname;
g_free (pathname);
elem = elem->next;
}
return NULL;
}
/* This is an internally used function to create pixmaps. */
GtkWidget*
create_pixmap (GtkWidget *widget,
const gchar *filename)
{
gchar *pathname = NULL;
GtkWidget *pixmap;
if (!filename || !filename[0])
return gtk_image_new ();
pathname = find_pixmap_file (filename);
if (!pathname)
{
g_warning ("Couldn't find pixmap file: %s", filename);
return gtk_image_new ();
}
pixmap = gtk_image_new_from_file (pathname);
g_free (pathname);
return pixmap;
}
/* This is an internally used function to create pixmaps. */
GdkPixbuf*
create_pixbuf (const gchar *filename)
{
gchar *pathname = NULL;
GdkPixbuf *pixbuf;
GError *error = NULL;
if (!filename || !filename[0])
return NULL;
pathname = find_pixmap_file (filename);
if (!pathname)
{
g_warning ("Couldn't find pixmap file: %s", filename);
return NULL;
}
pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
if (!pixbuf)
{
fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
pathname, error->message);
g_error_free (error);
}
g_free (pathname);
return pixbuf;
}
/* This is used to set ATK action descriptions. */
void
glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description)
{
gint n_actions, i;
n_actions = atk_action_get_n_actions (action);
for (i = 0; i < n_actions; i++)
{
if (!strcmp (atk_action_get_name (action, i), action_name))
atk_action_set_description (action, i, description);
}
}

View File

@ -1,44 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
/*
* Public Functions.
*/
/*
* This function returns a widget in a component created by Glade.
* Call it with the toplevel widget in the component (i.e. a window/dialog),
* or alternatively any widget in the component, and the name of the widget
* you want returned.
*/
GtkWidget* lookup_widget (GtkWidget *widget,
const gchar *widget_name);
/* Use this function to set the directory containing installed pixmaps. */
void add_pixmap_directory (const gchar *directory);
/*
* Private Functions.
*/
/* This is used to create the pixmaps used in the interface. */
GtkWidget* create_pixmap (GtkWidget *widget,
const gchar *filename);
/* This is used to create the pixbufs used in the interface. */
GdkPixbuf* create_pixbuf (const gchar *filename);
/* This is used to set ATK action descriptions. */
void glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description);

View File

@ -1,46 +0,0 @@
/* GTK+ Preference Tool
* Copyright (C) 2003-2005 Alex Shaduri.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/***************************************************************************
sys_win32.h - description
-------------------
begin : Wed Oct 22 2003
copyright : (C) 2003 by Alex Shaduri, Irakli A. Elizbarashvili
email : alex_sh@land.ru
***************************************************************************/
#ifndef SYS_WIN32_H
#define SYS_WIN32_H
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
#endif

View File

@ -1,98 +0,0 @@
/* GTK+ Preference Tool
* Copyright (C) 2003-2005 Alex Shaduri.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/***************************************************************************
win32util.cpp - description
-------------------
begin : Tue Jan 14 2003
copyright : (C) 2003 by Alex Shaduri
email : alex_sh@land.ru
***************************************************************************/
#ifdef _WIN32
#include <string>
#include "sys_win32.h"
#include "win32util.h"
std::string win32_get_registry_value_string(HKEY base, const std::string& keydir, const std::string& key)
{
HKEY reg_key = NULL;
DWORD type;
DWORD nbytes;
char* result = NULL;
//HKEY_CURRENT_USER
nbytes = 0;
if ( RegOpenKeyEx ( base, keydir.c_str(), 0, KEY_QUERY_VALUE, &reg_key) == ERROR_SUCCESS
&& RegQueryValueEx (reg_key, key.c_str(), 0, &type, NULL, &nbytes) == ERROR_SUCCESS ) {
result = (char*)malloc(nbytes + 1);
RegQueryValueEx (reg_key, key.c_str(), 0, &type, (BYTE*)result, &nbytes);
result[nbytes] = '\0';
}
if (reg_key != NULL)
RegCloseKey (reg_key);
std::string ret = "";
if (result) {
ret = result;
}
return ret;
}
void win32_set_registry_value_string(HKEY base, const std::string& keydir, const std::string& key, const std::string& value)
{
HKEY reg_key = NULL;
DWORD nbytes;
nbytes = value.length() + 1;
if ( RegOpenKeyEx ( base, keydir.c_str(), 0, KEY_QUERY_VALUE, &reg_key) == ERROR_SUCCESS) {
RegSetValueEx (reg_key, key.c_str(), 0, REG_SZ, (const BYTE*)(value.c_str()), nbytes);
}
if (reg_key != NULL)
RegCloseKey (reg_key);
}
#endif

View File

@ -1,44 +0,0 @@
/* GTK+ Preference Tool
* Copyright (C) 2003-2005 Alex Shaduri.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/***************************************************************************
win32util.h - description
-------------------
begin : Tue Jan 14 2003
copyright : (C) 2003 by Alex Shaduri
email : alex_sh@land.ru
***************************************************************************/
#ifndef WIN32UTIL_H
#define WIN32UTIL_H
#ifdef _WIN32
#include <string>
#include "sys_win32.h"
std::string win32_get_registry_value_string(HKEY base, const std::string& keydir, const std::string& key);
void win32_set_registry_value_string(HKEY base, const std::string& keydir, const std::string& key, const std::string& value);
#endif //_WIN32
#endif // WIN32UTIL_H