diff --git a/pcsx2/Linux/interface.c b/pcsx2/Linux/interface.c index 87e6a49abf..df94254c7e 100644 --- a/pcsx2/Linux/interface.c +++ b/pcsx2/Linux/interface.c @@ -2036,7 +2036,7 @@ create_ConfDlg (void) GtkWidget *hbuttonbox24; GtkWidget *GtkButton_FWconfigure; GtkWidget *GtkButton_FWtest; - GtkWidget *GtkButton_FireWireabout; + GtkWidget *GtkButton_FWabout; GtkWidget *label30; GtkWidget *GtkLabel_Bios; GtkWidget *hbox5; @@ -2385,11 +2385,11 @@ create_ConfDlg (void) gtk_container_add (GTK_CONTAINER (hbuttonbox24), GtkButton_FWtest); GTK_WIDGET_SET_FLAGS (GtkButton_FWtest, GTK_CAN_DEFAULT); - GtkButton_FireWireabout = gtk_button_new_with_mnemonic (_("About")); - gtk_widget_set_name (GtkButton_FireWireabout, "GtkButton_FireWireabout"); - gtk_widget_show (GtkButton_FireWireabout); - gtk_container_add (GTK_CONTAINER (hbuttonbox24), GtkButton_FireWireabout); - GTK_WIDGET_SET_FLAGS (GtkButton_FireWireabout, GTK_CAN_DEFAULT); + GtkButton_FWabout = gtk_button_new_with_mnemonic (_("About")); + gtk_widget_set_name (GtkButton_FWabout, "GtkButton_FWabout"); + gtk_widget_show (GtkButton_FWabout); + gtk_container_add (GTK_CONTAINER (hbuttonbox24), GtkButton_FWabout); + GTK_WIDGET_SET_FLAGS (GtkButton_FWabout, GTK_CAN_DEFAULT); label30 = gtk_label_new (_("FireWire")); gtk_widget_set_name (label30, "label30"); @@ -2518,7 +2518,7 @@ create_ConfDlg (void) g_signal_connect ((gpointer) GtkButton_FWtest, "clicked", G_CALLBACK (OnConfButton), NULL); - g_signal_connect ((gpointer) GtkButton_FireWireabout, "clicked", + g_signal_connect ((gpointer) GtkButton_FWabout, "clicked", G_CALLBACK (OnConfButton), NULL); g_signal_connect ((gpointer) GtkButton_SelectPluginsDir, "clicked", @@ -2585,7 +2585,7 @@ create_ConfDlg (void) GLADE_HOOKUP_OBJECT (ConfDlg, hbuttonbox24, "hbuttonbox24"); GLADE_HOOKUP_OBJECT (ConfDlg, GtkButton_FWconfigure, "GtkButton_FWconfigure"); GLADE_HOOKUP_OBJECT (ConfDlg, GtkButton_FWtest, "GtkButton_FWtest"); - GLADE_HOOKUP_OBJECT (ConfDlg, GtkButton_FireWireabout, "GtkButton_FireWireabout"); + GLADE_HOOKUP_OBJECT (ConfDlg, GtkButton_FWabout, "GtkButton_FWabout"); GLADE_HOOKUP_OBJECT (ConfDlg, label30, "label30"); GLADE_HOOKUP_OBJECT (ConfDlg, GtkLabel_Bios, "GtkLabel_Bios"); GLADE_HOOKUP_OBJECT (ConfDlg, hbox5, "hbox5"); diff --git a/pcsx2/Linux/pcsx2.glade b/pcsx2/Linux/pcsx2.glade index bb90d59e3d..a53cc57b60 100644 --- a/pcsx2/Linux/pcsx2.glade +++ b/pcsx2/Linux/pcsx2.glade @@ -4413,7 +4413,7 @@ Configure them here.</b> - + True True True diff --git a/plugins/CDVDnull/CDVD.cpp b/plugins/CDVDnull/CDVD.cpp index 7d922872a7..29ed1642cb 100644 --- a/plugins/CDVDnull/CDVD.cpp +++ b/plugins/CDVDnull/CDVD.cpp @@ -17,7 +17,6 @@ */ #include - #include "CDVD.h" const char *LibName = "CDVDnull Driver"; diff --git a/plugins/CDVDnull/Linux/Config.cpp b/plugins/CDVDnull/Linux/Config.cpp index fead9422be..1c641a0ffd 100644 --- a/plugins/CDVDnull/Linux/Config.cpp +++ b/plugins/CDVDnull/Linux/Config.cpp @@ -46,7 +46,7 @@ void SysMessage(const char *fmt, ...) MsgDlg = gtk_window_new(GTK_WINDOW_POPUP); gtk_window_set_position(GTK_WINDOW(MsgDlg), GTK_WIN_POS_CENTER); - gtk_window_set_title(GTK_WINDOW(MsgDlg), "SPU2null Msg"); + gtk_window_set_title(GTK_WINDOW(MsgDlg), "CDVDnull Msg"); gtk_container_set_border_width(GTK_CONTAINER(MsgDlg), 5); Box = gtk_vbox_new(5, 0); diff --git a/plugins/FWnull/Linux/Linux.h b/plugins/CDVDnull/Linux/Config.h similarity index 93% rename from plugins/FWnull/Linux/Linux.h rename to plugins/CDVDnull/Linux/Config.h index ed6cd2d1cb..ac1b6a60b5 100644 --- a/plugins/FWnull/Linux/Linux.h +++ b/plugins/CDVDnull/Linux/Config.h @@ -1,5 +1,5 @@ -/* FWnull - * Copyright (C) 2004-2009 PCSX2 Team +/* CDVDnull + * Copyright (C) 2002-2009 Pcsx2 Team * * 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 diff --git a/plugins/CDVDnull/Linux/callbacks.c b/plugins/CDVDnull/Linux/callbacks.c new file mode 100644 index 0000000000..e87ed8be2d --- /dev/null +++ b/plugins/CDVDnull/Linux/callbacks.c @@ -0,0 +1,34 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + + +void +OnConf_Ok (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnConf_Cancel (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnAbout_Ok (GtkButton *button, + gpointer user_data) +{ + +} + diff --git a/plugins/CDVDnull/Linux/callbacks.h b/plugins/CDVDnull/Linux/callbacks.h new file mode 100644 index 0000000000..e606c242f0 --- /dev/null +++ b/plugins/CDVDnull/Linux/callbacks.h @@ -0,0 +1,14 @@ +#include + + +void +OnConf_Ok (GtkButton *button, + gpointer user_data); + +void +OnConf_Cancel (GtkButton *button, + gpointer user_data); + +void +OnAbout_Ok (GtkButton *button, + gpointer user_data); diff --git a/plugins/CDVDnull/Linux/interface.c b/plugins/CDVDnull/Linux/interface.c new file mode 100644 index 0000000000..f290071448 --- /dev/null +++ b/plugins/CDVDnull/Linux/interface.c @@ -0,0 +1,173 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#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_Config (void) +{ + GtkWidget *Config; + GtkWidget *vbox1; + GtkWidget *frame3; + GtkWidget *alignment1; + GtkWidget *check_logging; + GtkWidget *label15; + GtkWidget *hbuttonbox1; + GtkWidget *button1; + GtkWidget *button2; + + Config = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name (Config, "Config"); + gtk_container_set_border_width (GTK_CONTAINER (Config), 5); + gtk_window_set_title (GTK_WINDOW (Config), _("CDVDconfig")); + + vbox1 = gtk_vbox_new (FALSE, 5); + gtk_widget_set_name (vbox1, "vbox1"); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (Config), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5); + + frame3 = gtk_frame_new (NULL); + gtk_widget_set_name (frame3, "frame3"); + gtk_widget_show (frame3); + gtk_box_pack_start (GTK_BOX (vbox1), frame3, TRUE, TRUE, 0); + gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_NONE); + + alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_set_name (alignment1, "alignment1"); + gtk_widget_show (alignment1); + gtk_container_add (GTK_CONTAINER (frame3), alignment1); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0); + + check_logging = gtk_check_button_new_with_mnemonic (_("Enable Logging")); + gtk_widget_set_name (check_logging, "check_logging"); + gtk_widget_show (check_logging); + gtk_container_add (GTK_CONTAINER (alignment1), check_logging); + + label15 = gtk_label_new (_("Logging")); + gtk_widget_set_name (label15, "label15"); + gtk_widget_show (label15); + gtk_frame_set_label_widget (GTK_FRAME (frame3), label15); + gtk_label_set_use_markup (GTK_LABEL (label15), TRUE); + + hbuttonbox1 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox1, "hbuttonbox1"); + gtk_widget_show (hbuttonbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0); + gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30); + + button1 = gtk_button_new_with_mnemonic (_("Ok")); + gtk_widget_set_name (button1, "button1"); + gtk_widget_show (button1); + gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1); + GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT); + + button2 = gtk_button_new_with_mnemonic (_("Cancel")); + gtk_widget_set_name (button2, "button2"); + gtk_widget_show (button2); + gtk_container_add (GTK_CONTAINER (hbuttonbox1), button2); + GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT); + + g_signal_connect ((gpointer) button1, "clicked", + G_CALLBACK (OnConf_Ok), + NULL); + g_signal_connect ((gpointer) button2, "clicked", + G_CALLBACK (OnConf_Cancel), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config"); + GLADE_HOOKUP_OBJECT (Config, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (Config, frame3, "frame3"); + GLADE_HOOKUP_OBJECT (Config, alignment1, "alignment1"); + GLADE_HOOKUP_OBJECT (Config, check_logging, "check_logging"); + GLADE_HOOKUP_OBJECT (Config, label15, "label15"); + GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1"); + GLADE_HOOKUP_OBJECT (Config, button1, "button1"); + GLADE_HOOKUP_OBJECT (Config, button2, "button2"); + + return Config; +} + +GtkWidget* +create_About (void) +{ + GtkWidget *About; + GtkWidget *vbox2; + GtkWidget *label2; + GtkWidget *label3; + GtkWidget *hbuttonbox2; + GtkWidget *button3; + + About = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name (About, "About"); + gtk_container_set_border_width (GTK_CONTAINER (About), 5); + gtk_window_set_title (GTK_WINDOW (About), _("CDVDabout")); + + vbox2 = gtk_vbox_new (FALSE, 5); + gtk_widget_set_name (vbox2, "vbox2"); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (About), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 5); + + label2 = gtk_label_new (_("CDVD Null Driver")); + gtk_widget_set_name (label2, "label2"); + gtk_widget_show (label2); + gtk_box_pack_start (GTK_BOX (vbox2), label2, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER); + + label3 = gtk_label_new (_("Original Author: (Not sure. linuzappz?)\nRevised by arcum42@gmail.com")); + gtk_widget_set_name (label3, "label3"); + gtk_widget_show (label3); + gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0); + + hbuttonbox2 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox2, "hbuttonbox2"); + gtk_widget_show (hbuttonbox2); + gtk_box_pack_start (GTK_BOX (vbox2), hbuttonbox2, TRUE, TRUE, 0); + gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 30); + + button3 = gtk_button_new_with_mnemonic (_("Ok")); + gtk_widget_set_name (button3, "button3"); + gtk_widget_show (button3); + gtk_container_add (GTK_CONTAINER (hbuttonbox2), button3); + GTK_WIDGET_SET_FLAGS (button3, GTK_CAN_DEFAULT); + + g_signal_connect ((gpointer) button3, "clicked", + G_CALLBACK (OnAbout_Ok), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (About, About, "About"); + GLADE_HOOKUP_OBJECT (About, vbox2, "vbox2"); + GLADE_HOOKUP_OBJECT (About, label2, "label2"); + GLADE_HOOKUP_OBJECT (About, label3, "label3"); + GLADE_HOOKUP_OBJECT (About, hbuttonbox2, "hbuttonbox2"); + GLADE_HOOKUP_OBJECT (About, button3, "button3"); + + return About; +} + diff --git a/plugins/CDVDnull/Linux/interface.h b/plugins/CDVDnull/Linux/interface.h new file mode 100644 index 0000000000..69c303ba3b --- /dev/null +++ b/plugins/CDVDnull/Linux/interface.h @@ -0,0 +1,6 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +GtkWidget* create_Config (void); +GtkWidget* create_About (void); diff --git a/plugins/CDVDnull/Linux/support.c b/plugins/CDVDnull/Linux/support.c new file mode 100644 index 0000000000..00aff29822 --- /dev/null +++ b/plugins/CDVDnull/Linux/support.c @@ -0,0 +1,144 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include + +#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); + } +} + diff --git a/plugins/CDVDnull/Linux/support.h b/plugins/CDVDnull/Linux/support.h new file mode 100644 index 0000000000..a32649e53c --- /dev/null +++ b/plugins/CDVDnull/Linux/support.h @@ -0,0 +1,69 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +/* + * Standard gettext macros. + */ +#ifdef ENABLE_NLS +# include +# undef _ +# define _(String) dgettext (PACKAGE, String) +# define Q_(String) g_strip_context ((String), gettext (String)) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif +#else +# define textdomain(String) (String) +# define gettext(String) (String) +# define dgettext(Domain,Message) (Message) +# define dcgettext(Domain,Message,Type) (Message) +# define bindtextdomain(Domain,Directory) (Domain) +# define _(String) (String) +# define Q_(String) g_strip_context ((String), (String)) +# define N_(String) (String) +#endif + + +/* + * 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); + diff --git a/plugins/FWnull/FW.cpp b/plugins/FWnull/FW.cpp index 93a9a7a1d4..c4503cab30 100644 --- a/plugins/FWnull/FW.cpp +++ b/plugins/FWnull/FW.cpp @@ -29,10 +29,12 @@ const unsigned char revision = 0; const unsigned char build = 5; // increase that with each version static char *libraryName = "FWnull Driver"; +string s_strIniPath="inis/FWnull.ini"; + s8 *fwregs; FILE *fwLog; Config conf; -string s_strIniPath="inis/FWnull.ini"; + void (*FWirq)(); EXPORT_C_(u32) PS2EgetLibType() diff --git a/plugins/FWnull/Linux/Config.cpp b/plugins/FWnull/Linux/Config.cpp index 5cd7583574..c40b4055e8 100644 --- a/plugins/FWnull/Linux/Config.cpp +++ b/plugins/FWnull/Linux/Config.cpp @@ -51,7 +51,7 @@ void OnMsg_Ok() gtk_main_quit(); } -void cfgSysMessage(char *fmt, ...) +void SysMessage(char *fmt, ...) { GtkWidget *Ok,*Txt; GtkWidget *Box,*Box1; @@ -92,21 +92,23 @@ void cfgSysMessage(char *fmt, ...) gtk_main(); } - + void OnAbout_Ok(GtkButton *button, gpointer user_data) { gtk_widget_destroy(About); gtk_main_quit(); } -void CFGabout() +EXPORT_C_(void) FWabout() { About = create_About(); gtk_widget_show_all(About); gtk_main(); } -void OnConf_Ok(GtkButton *button, gpointer user_data) { +void OnConf_Ok(GtkButton *button, gpointer user_data) +{ + conf.Log = is_checked(Conf, "check_logging"); SaveConfig(); gtk_widget_destroy(Conf); @@ -119,36 +121,16 @@ void OnConf_Cancel(GtkButton *button, gpointer user_data) gtk_main_quit(); } -void CFGconfigure() +EXPORT_C_(void) FWconfigure() { + LoadConfig(); Conf = create_Config(); - LoadConfig(); - + set_checked(Conf, "check_logging", conf.Log); gtk_widget_show_all(Conf); gtk_main(); } -long CFGmessage(char *msg) { - cfgSysMessage(msg); - - return 0; -} - -/*int main(int argc, char *argv[]) { - gtk_init(NULL, NULL); - - if (!strcmp(argv[1], "configure")) { - CFGconfigure(); - } else if (!strcmp(argv[1], "about")) { - CFGabout(); - } else if (!strcmp(argv[1], "message")) { - CFGmessage(argv[2]); - } - - return 0; -}*/ - void LoadConfig() { FILE *f; @@ -162,6 +144,7 @@ void LoadConfig() SaveConfig();//save and return return; } + fscanf(f, "logging = %hhx\n", &conf.Log); //fscanf(f, "options = %hhx\n", &confOptions); fclose(f); } @@ -175,10 +158,10 @@ void SaveConfig() f = fopen(cfg,"w"); if (f == NULL) { - printf("failed to open %s\n", s_strIniPath.c_str()); + printf("failed to open '%s'\n", s_strIniPath.c_str()); return; } - + fprintf(f, "logging = %hhx\n", conf.Log); //fprintf(f, "options = %hhx\n", confOptions); fclose(f); } diff --git a/plugins/FWnull/Linux/Config.h b/plugins/FWnull/Linux/Config.h index 824a7dafe7..7251ed01eb 100644 --- a/plugins/FWnull/Linux/Config.h +++ b/plugins/FWnull/Linux/Config.h @@ -18,8 +18,7 @@ void SaveConf(); void LoadConf(); +void SysMessage(char *fmt, ...); -extern long CFGmessage(char *msg); -extern void CFGconfigure(); -extern void cfgSysMessage(char *fmt, ...); -extern void CFGabout(); +#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)))) +#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state) diff --git a/plugins/FWnull/Linux/firewire.glade b/plugins/FWnull/Linux/firewire.glade index cef4eab65e..17c3f83051 100644 --- a/plugins/FWnull/Linux/firewire.glade +++ b/plugins/FWnull/Linux/firewire.glade @@ -6,7 +6,7 @@ 5 True - DEV9config + FWconfig GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -27,240 +27,37 @@ False 5 - - - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - 5 - True - True - 5 - - - - True - Device: - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - - - - 0 - False - False - - - - - - - - True - Ethernet - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - True - True - - - True 0 0.5 - GTK_SHADOW_ETCHED_IN + GTK_SHADOW_NONE - - 5 + True - True - 5 + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 - + True - Device: - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + True + Enable Logging + True + GTK_RELIEF_NORMAL + True + False + False + True - - 0 - False - False - - - - - - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - - - - 0 - False - False - @@ -268,9 +65,9 @@ True - Hdd + <b>Logging</b> False - False + True GTK_JUSTIFY_LEFT False False @@ -340,7 +137,7 @@ 5 True - DEV9about + FWabout GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -389,7 +186,8 @@ True - Author: linuzappz <linuzappz@hotmail.com> + Original Author: linuzappz <linuzappz@hotmail.com> +Revised by arcum42@gmail.com False False GTK_JUSTIFY_LEFT diff --git a/plugins/FWnull/Linux/interface.c b/plugins/FWnull/Linux/interface.c index 5c23358a21..13f79cea74 100644 --- a/plugins/FWnull/Linux/interface.c +++ b/plugins/FWnull/Linux/interface.c @@ -31,19 +31,9 @@ create_Config (void) { GtkWidget *Config; GtkWidget *vbox1; - GtkWidget *frame2; - GtkWidget *hbox1; - GtkWidget *label4; - GtkWidget *GtkCombo_Eth; - GList *GtkCombo_Eth_items = NULL; - GtkWidget *combo_entry1; - GtkWidget *label1; GtkWidget *frame3; - GtkWidget *hbox2; - GtkWidget *label5; - GtkWidget *GtkCombo_Hdd; - GList *GtkCombo_Hdd_items = NULL; - GtkWidget *entry1; + GtkWidget *alignment1; + GtkWidget *check_logging; GtkWidget *label15; GtkWidget *hbuttonbox1; GtkWidget *button1; @@ -52,7 +42,7 @@ create_Config (void) Config = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_name (Config, "Config"); gtk_container_set_border_width (GTK_CONTAINER (Config), 5); - gtk_window_set_title (GTK_WINDOW (Config), _("DEV9config")); + gtk_window_set_title (GTK_WINDOW (Config), _("FWconfig")); vbox1 = gtk_vbox_new (FALSE, 5); gtk_widget_set_name (vbox1, "vbox1"); @@ -60,77 +50,28 @@ create_Config (void) gtk_container_add (GTK_CONTAINER (Config), vbox1); gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5); - frame2 = gtk_frame_new (NULL); - gtk_widget_set_name (frame2, "frame2"); - gtk_widget_show (frame2); - gtk_box_pack_start (GTK_BOX (vbox1), frame2, TRUE, TRUE, 0); - - hbox1 = gtk_hbox_new (TRUE, 5); - gtk_widget_set_name (hbox1, "hbox1"); - gtk_widget_show (hbox1); - gtk_container_add (GTK_CONTAINER (frame2), hbox1); - gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5); - - label4 = gtk_label_new (_("Device:")); - gtk_widget_set_name (label4, "label4"); - gtk_widget_show (label4); - gtk_box_pack_start (GTK_BOX (hbox1), label4, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_CENTER); - - GtkCombo_Eth = gtk_combo_new (); - g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Eth)->popwin), - "GladeParentKey", GtkCombo_Eth); - gtk_widget_set_name (GtkCombo_Eth, "GtkCombo_Eth"); - gtk_widget_show (GtkCombo_Eth); - gtk_box_pack_start (GTK_BOX (hbox1), GtkCombo_Eth, FALSE, FALSE, 0); - GtkCombo_Eth_items = g_list_append (GtkCombo_Eth_items, (gpointer) ""); - gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Eth), GtkCombo_Eth_items); - g_list_free (GtkCombo_Eth_items); - - combo_entry1 = GTK_COMBO (GtkCombo_Eth)->entry; - gtk_widget_set_name (combo_entry1, "combo_entry1"); - gtk_widget_show (combo_entry1); - - label1 = gtk_label_new (_("Ethernet")); - gtk_widget_set_name (label1, "label1"); - gtk_widget_show (label1); - gtk_frame_set_label_widget (GTK_FRAME (frame2), label1); - frame3 = gtk_frame_new (NULL); gtk_widget_set_name (frame3, "frame3"); gtk_widget_show (frame3); gtk_box_pack_start (GTK_BOX (vbox1), frame3, TRUE, TRUE, 0); + gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_NONE); - hbox2 = gtk_hbox_new (TRUE, 5); - gtk_widget_set_name (hbox2, "hbox2"); - gtk_widget_show (hbox2); - gtk_container_add (GTK_CONTAINER (frame3), hbox2); - gtk_container_set_border_width (GTK_CONTAINER (hbox2), 5); + alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_set_name (alignment1, "alignment1"); + gtk_widget_show (alignment1); + gtk_container_add (GTK_CONTAINER (frame3), alignment1); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0); - label5 = gtk_label_new (_("Device:")); - gtk_widget_set_name (label5, "label5"); - gtk_widget_show (label5); - gtk_box_pack_start (GTK_BOX (hbox2), label5, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_CENTER); + check_logging = gtk_check_button_new_with_mnemonic (_("Enable Logging")); + gtk_widget_set_name (check_logging, "check_logging"); + gtk_widget_show (check_logging); + gtk_container_add (GTK_CONTAINER (alignment1), check_logging); - GtkCombo_Hdd = gtk_combo_new (); - g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Hdd)->popwin), - "GladeParentKey", GtkCombo_Hdd); - gtk_widget_set_name (GtkCombo_Hdd, "GtkCombo_Hdd"); - gtk_widget_show (GtkCombo_Hdd); - gtk_box_pack_start (GTK_BOX (hbox2), GtkCombo_Hdd, FALSE, FALSE, 0); - GtkCombo_Hdd_items = g_list_append (GtkCombo_Hdd_items, (gpointer) ""); - gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Hdd), GtkCombo_Hdd_items); - g_list_free (GtkCombo_Hdd_items); - - entry1 = GTK_COMBO (GtkCombo_Hdd)->entry; - gtk_widget_set_name (entry1, "entry1"); - gtk_widget_show (entry1); - - label15 = gtk_label_new (_("Hdd")); + label15 = gtk_label_new (_("Logging")); gtk_widget_set_name (label15, "label15"); gtk_widget_show (label15); gtk_frame_set_label_widget (GTK_FRAME (frame3), label15); + gtk_label_set_use_markup (GTK_LABEL (label15), TRUE); hbuttonbox1 = gtk_hbutton_box_new (); gtk_widget_set_name (hbuttonbox1, "hbuttonbox1"); @@ -160,17 +101,9 @@ create_Config (void) /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config"); GLADE_HOOKUP_OBJECT (Config, vbox1, "vbox1"); - GLADE_HOOKUP_OBJECT (Config, frame2, "frame2"); - GLADE_HOOKUP_OBJECT (Config, hbox1, "hbox1"); - GLADE_HOOKUP_OBJECT (Config, label4, "label4"); - GLADE_HOOKUP_OBJECT (Config, GtkCombo_Eth, "GtkCombo_Eth"); - GLADE_HOOKUP_OBJECT (Config, combo_entry1, "combo_entry1"); - GLADE_HOOKUP_OBJECT (Config, label1, "label1"); GLADE_HOOKUP_OBJECT (Config, frame3, "frame3"); - GLADE_HOOKUP_OBJECT (Config, hbox2, "hbox2"); - GLADE_HOOKUP_OBJECT (Config, label5, "label5"); - GLADE_HOOKUP_OBJECT (Config, GtkCombo_Hdd, "GtkCombo_Hdd"); - GLADE_HOOKUP_OBJECT (Config, entry1, "entry1"); + GLADE_HOOKUP_OBJECT (Config, alignment1, "alignment1"); + GLADE_HOOKUP_OBJECT (Config, check_logging, "check_logging"); GLADE_HOOKUP_OBJECT (Config, label15, "label15"); GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1"); GLADE_HOOKUP_OBJECT (Config, button1, "button1"); @@ -192,7 +125,7 @@ create_About (void) About = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_name (About, "About"); gtk_container_set_border_width (GTK_CONTAINER (About), 5); - gtk_window_set_title (GTK_WINDOW (About), _("DEV9about")); + gtk_window_set_title (GTK_WINDOW (About), _("FWabout")); vbox2 = gtk_vbox_new (FALSE, 5); gtk_widget_set_name (vbox2, "vbox2"); @@ -206,7 +139,7 @@ create_About (void) gtk_box_pack_start (GTK_BOX (vbox2), label2, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER); - label3 = gtk_label_new (_("Author: linuzappz ")); + label3 = gtk_label_new (_("Original Author: linuzappz \nRevised by arcum42@gmail.com")); gtk_widget_set_name (label3, "label3"); gtk_widget_show (label3); gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0); diff --git a/plugins/FWnull/Makefile.am b/plugins/FWnull/Makefile.am index 60060ae259..bde89b4aef 100644 --- a/plugins/FWnull/Makefile.am +++ b/plugins/FWnull/Makefile.am @@ -22,13 +22,11 @@ libFWnull_LDFLAGS= @SHARED_LDFLAGS@ libFWnull_LDFLAGS+=-Wl,-soname,@libFWnull_SONAME@ libFWnull_LDADD=$(libFWnull_a_OBJECTS) -libFWnull_a_SOURCES = FW.cpp Linux/Config.cpp Linux/Linux.cpp \ -FW.h Linux/Config.h Linux/Linux.h +libFWnull_a_SOURCES = FW.cpp FW.h Linux/Config.cpp Linux/Config.h libFWnull_a_SOURCES += \ Linux/interface.h Linux/support.c \ Linux/interface.c Linux/support.h \ Linux/callbacks.h -#Linux/callbacks.c #SUBDIRS = Linux \ No newline at end of file diff --git a/plugins/SPU2null/Linux/Config.cpp b/plugins/SPU2null/Linux/Config.cpp index a42fc933a1..2e6e4aed6d 100644 --- a/plugins/SPU2null/Linux/Config.cpp +++ b/plugins/SPU2null/Linux/Config.cpp @@ -16,12 +16,25 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "Config.h" #include "SPU2.h" -#include -#include + #ifdef __cplusplus +extern "C" +{ +#endif -GtkWidget *MsgDlg; +#include "support.h" +#include "callbacks.h" +#include "interface.h" + +#ifdef __cplusplus +} +#endif + +using namespace std; + +GtkWidget *MsgDlg, *About, *Conf; void OnMsg_Ok() { @@ -71,16 +84,81 @@ void SysMessage(char *fmt, ...) gtk_main(); } +void OnAbout_Ok(GtkButton *button, gpointer user_data) +{ + gtk_widget_destroy(About); + gtk_main_quit(); +} + +void OnConf_Ok(GtkButton *button, gpointer user_data) +{ + conf.Log = is_checked(Conf, "check_logging"); + SaveConfig(); + + gtk_widget_destroy(Conf); + gtk_main_quit(); +} + +void OnConf_Cancel(GtkButton *button, gpointer user_data) +{ + gtk_widget_destroy(Conf); + gtk_main_quit(); +} + EXPORT_C_(void) SPU2configure() { - SysMessage("Nothing to Configure"); + //SysMessage("Nothing to Configure"); + + Conf = create_Config(); + + LoadConfig(); + + set_checked(Conf, "check_logging", conf.Log); + gtk_widget_show_all(Conf); + gtk_main(); } EXPORT_C_(void) SPU2about() { - SysMessage("%s %d.%d", libraryName, version, build); + //SysMessage("%s %d.%d", libraryName, version, build); + + About = create_About(); + gtk_widget_show_all(About); + gtk_main(); } -void LoadConfig() +void LoadConfig() { + FILE *f; + char cfg[255]; + + strcpy(cfg, s_strIniPath.c_str()); + f = fopen(cfg, "r"); + if (f == NULL) + { + printf("failed to open %s\n", s_strIniPath.c_str()); + SaveConfig();//save and return + return; + } + fscanf(f, "logging = %hhx\n", &conf.Log); + //fscanf(f, "options = %hhx\n", &confOptions); + fclose(f); } + +void SaveConfig() +{ + FILE *f; + char cfg[255]; + + strcpy(cfg, s_strIniPath.c_str()); + f = fopen(cfg,"w"); + if (f == NULL) + { + printf("failed to open %s\n", s_strIniPath.c_str()); + return; + } + + fprintf(f, "logging = %hhx\n", conf.Log); + //fprintf(f, "options = %hhx\n", confOptions); + fclose(f); +} \ No newline at end of file diff --git a/plugins/FWnull/Linux/Linux.cpp b/plugins/SPU2null/Linux/Config.h similarity index 62% rename from plugins/FWnull/Linux/Linux.cpp rename to plugins/SPU2null/Linux/Config.h index 626584ce52..ea196262a9 100644 --- a/plugins/FWnull/Linux/Linux.cpp +++ b/plugins/SPU2null/Linux/Config.h @@ -1,5 +1,5 @@ -/* FWnull - * Copyright (C) 2004-2009 PCSX2 Team +/* SPU2null + * Copyright (C) 2002-2005 SPU2null Team * * 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 @@ -14,40 +14,17 @@ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - + */ + #include -#include #include -#include -#include -#include -#include -#include +#include +#include +using namespace std; -#include "FW.h" -#include "Config.h" - -void SysMessage(char *fmt, ...) -{ - va_list list; - char msg[512]; - char cmd[512]; - - va_start(list, fmt); - vsprintf(msg, fmt, list); - va_end(list); - - cfgSysMessage(msg); -} - -void FWconfigure() -{ - CFGconfigure(); -} - -void FWabout() -{ - CFGabout(); -} +void SaveConf(); +void LoadConf(); +extern string s_strIniPath; +#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)))) +#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state) diff --git a/plugins/SPU2null/Linux/callbacks.c b/plugins/SPU2null/Linux/callbacks.c new file mode 100644 index 0000000000..e87ed8be2d --- /dev/null +++ b/plugins/SPU2null/Linux/callbacks.c @@ -0,0 +1,34 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + + +void +OnConf_Ok (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnConf_Cancel (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnAbout_Ok (GtkButton *button, + gpointer user_data) +{ + +} + diff --git a/plugins/SPU2null/Linux/callbacks.h b/plugins/SPU2null/Linux/callbacks.h new file mode 100644 index 0000000000..e606c242f0 --- /dev/null +++ b/plugins/SPU2null/Linux/callbacks.h @@ -0,0 +1,14 @@ +#include + + +void +OnConf_Ok (GtkButton *button, + gpointer user_data); + +void +OnConf_Cancel (GtkButton *button, + gpointer user_data); + +void +OnAbout_Ok (GtkButton *button, + gpointer user_data); diff --git a/plugins/SPU2null/Linux/interface.c b/plugins/SPU2null/Linux/interface.c new file mode 100644 index 0000000000..1efa3adbbd --- /dev/null +++ b/plugins/SPU2null/Linux/interface.c @@ -0,0 +1,173 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#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_Config (void) +{ + GtkWidget *Config; + GtkWidget *vbox1; + GtkWidget *frame3; + GtkWidget *alignment1; + GtkWidget *check_logging; + GtkWidget *label15; + GtkWidget *hbuttonbox1; + GtkWidget *button1; + GtkWidget *button2; + + Config = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name (Config, "Config"); + gtk_container_set_border_width (GTK_CONTAINER (Config), 5); + gtk_window_set_title (GTK_WINDOW (Config), _("SPU2config")); + + vbox1 = gtk_vbox_new (FALSE, 5); + gtk_widget_set_name (vbox1, "vbox1"); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (Config), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5); + + frame3 = gtk_frame_new (NULL); + gtk_widget_set_name (frame3, "frame3"); + gtk_widget_show (frame3); + gtk_box_pack_start (GTK_BOX (vbox1), frame3, TRUE, TRUE, 0); + gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_NONE); + + alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_set_name (alignment1, "alignment1"); + gtk_widget_show (alignment1); + gtk_container_add (GTK_CONTAINER (frame3), alignment1); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0); + + check_logging = gtk_check_button_new_with_mnemonic (_("Enable Logging")); + gtk_widget_set_name (check_logging, "check_logging"); + gtk_widget_show (check_logging); + gtk_container_add (GTK_CONTAINER (alignment1), check_logging); + + label15 = gtk_label_new (_("Logging")); + gtk_widget_set_name (label15, "label15"); + gtk_widget_show (label15); + gtk_frame_set_label_widget (GTK_FRAME (frame3), label15); + gtk_label_set_use_markup (GTK_LABEL (label15), TRUE); + + hbuttonbox1 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox1, "hbuttonbox1"); + gtk_widget_show (hbuttonbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0); + gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30); + + button1 = gtk_button_new_with_mnemonic (_("Ok")); + gtk_widget_set_name (button1, "button1"); + gtk_widget_show (button1); + gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1); + GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT); + + button2 = gtk_button_new_with_mnemonic (_("Cancel")); + gtk_widget_set_name (button2, "button2"); + gtk_widget_show (button2); + gtk_container_add (GTK_CONTAINER (hbuttonbox1), button2); + GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT); + + g_signal_connect ((gpointer) button1, "clicked", + G_CALLBACK (OnConf_Ok), + NULL); + g_signal_connect ((gpointer) button2, "clicked", + G_CALLBACK (OnConf_Cancel), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config"); + GLADE_HOOKUP_OBJECT (Config, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (Config, frame3, "frame3"); + GLADE_HOOKUP_OBJECT (Config, alignment1, "alignment1"); + GLADE_HOOKUP_OBJECT (Config, check_logging, "check_logging"); + GLADE_HOOKUP_OBJECT (Config, label15, "label15"); + GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1"); + GLADE_HOOKUP_OBJECT (Config, button1, "button1"); + GLADE_HOOKUP_OBJECT (Config, button2, "button2"); + + return Config; +} + +GtkWidget* +create_About (void) +{ + GtkWidget *About; + GtkWidget *vbox2; + GtkWidget *label2; + GtkWidget *label3; + GtkWidget *hbuttonbox2; + GtkWidget *button3; + + About = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name (About, "About"); + gtk_container_set_border_width (GTK_CONTAINER (About), 5); + gtk_window_set_title (GTK_WINDOW (About), _("SPU2about")); + + vbox2 = gtk_vbox_new (FALSE, 5); + gtk_widget_set_name (vbox2, "vbox2"); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (About), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 5); + + label2 = gtk_label_new (_("SPU2 Null Driver")); + gtk_widget_set_name (label2, "label2"); + gtk_widget_show (label2); + gtk_box_pack_start (GTK_BOX (vbox2), label2, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER); + + label3 = gtk_label_new (_("Original Author: ? (zerofrog? linuz?)\nRevised by arcum42@gmail.com")); + gtk_widget_set_name (label3, "label3"); + gtk_widget_show (label3); + gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0); + + hbuttonbox2 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox2, "hbuttonbox2"); + gtk_widget_show (hbuttonbox2); + gtk_box_pack_start (GTK_BOX (vbox2), hbuttonbox2, TRUE, TRUE, 0); + gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 30); + + button3 = gtk_button_new_with_mnemonic (_("Ok")); + gtk_widget_set_name (button3, "button3"); + gtk_widget_show (button3); + gtk_container_add (GTK_CONTAINER (hbuttonbox2), button3); + GTK_WIDGET_SET_FLAGS (button3, GTK_CAN_DEFAULT); + + g_signal_connect ((gpointer) button3, "clicked", + G_CALLBACK (OnAbout_Ok), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (About, About, "About"); + GLADE_HOOKUP_OBJECT (About, vbox2, "vbox2"); + GLADE_HOOKUP_OBJECT (About, label2, "label2"); + GLADE_HOOKUP_OBJECT (About, label3, "label3"); + GLADE_HOOKUP_OBJECT (About, hbuttonbox2, "hbuttonbox2"); + GLADE_HOOKUP_OBJECT (About, button3, "button3"); + + return About; +} + diff --git a/plugins/SPU2null/Linux/interface.h b/plugins/SPU2null/Linux/interface.h new file mode 100644 index 0000000000..69c303ba3b --- /dev/null +++ b/plugins/SPU2null/Linux/interface.h @@ -0,0 +1,6 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +GtkWidget* create_Config (void); +GtkWidget* create_About (void); diff --git a/plugins/SPU2null/Linux/spu2.glade b/plugins/SPU2null/Linux/spu2.glade new file mode 100644 index 0000000000..75ce9f6b74 --- /dev/null +++ b/plugins/SPU2null/Linux/spu2.glade @@ -0,0 +1,241 @@ + + + + + + + 5 + True + SPU2config + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + 5 + True + False + 5 + + + + True + 0 + 0.5 + GTK_SHADOW_NONE + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + True + Enable Logging + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + + + + True + <b>Logging</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 30 + + + + True + True + True + Ok + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + Cancel + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + True + True + + + + + + + + 5 + True + SPU2about + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + 5 + True + False + 5 + + + + True + SPU2 Null Driver + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + Original Author: ? (zerofrog? linuz?) +Revised by arcum42@gmail.com + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 30 + + + + True + True + True + Ok + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + True + True + + + + + + + diff --git a/plugins/SPU2null/Linux/support.c b/plugins/SPU2null/Linux/support.c new file mode 100644 index 0000000000..00aff29822 --- /dev/null +++ b/plugins/SPU2null/Linux/support.c @@ -0,0 +1,144 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include + +#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); + } +} + diff --git a/plugins/SPU2null/Linux/support.h b/plugins/SPU2null/Linux/support.h new file mode 100644 index 0000000000..a32649e53c --- /dev/null +++ b/plugins/SPU2null/Linux/support.h @@ -0,0 +1,69 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +/* + * Standard gettext macros. + */ +#ifdef ENABLE_NLS +# include +# undef _ +# define _(String) dgettext (PACKAGE, String) +# define Q_(String) g_strip_context ((String), gettext (String)) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif +#else +# define textdomain(String) (String) +# define gettext(String) (String) +# define dgettext(Domain,Message) (Message) +# define dcgettext(Domain,Message,Type) (Message) +# define bindtextdomain(Domain,Directory) (Domain) +# define _(String) (String) +# define Q_(String) g_strip_context ((String), (String)) +# define N_(String) (String) +#endif + + +/* + * 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); + diff --git a/plugins/SPU2null/Makefile.am b/plugins/SPU2null/Makefile.am index 394dba22a3..768683e86f 100644 --- a/plugins/SPU2null/Makefile.am +++ b/plugins/SPU2null/Makefile.am @@ -22,6 +22,11 @@ libSPU2null_LDFLAGS= @SHARED_LDFLAGS@ libSPU2null_LDFLAGS+=-Wl,-soname,@libSPU2null_SONAME@ libSPU2null_LDADD=$(libSPU2null_a_OBJECTS) -libSPU2null_a_SOURCES = SPU2.cpp SPU2.h Linux/Config.cpp +libSPU2null_a_SOURCES = SPU2.cpp SPU2.h Linux/Config.cpp + +libSPU2null_a_SOURCES += \ +Linux/interface.h Linux/support.c \ +Linux/interface.c Linux/support.h \ +Linux/callbacks.h #SUBDIRS = Linux \ No newline at end of file diff --git a/plugins/SPU2null/SPU2.cpp b/plugins/SPU2null/SPU2.cpp index e8a8e23697..7040b31178 100644 --- a/plugins/SPU2null/SPU2.cpp +++ b/plugins/SPU2null/SPU2.cpp @@ -20,7 +20,9 @@ #include #include - +#include +using namespace std; + const unsigned char version = PS2E_SPU2_VERSION; const unsigned char revision = 0; const unsigned char build = 7; // increase that with each version @@ -38,6 +40,7 @@ char *libraryName = "SPU2null (Debug)"; #else char *libraryName = "SPU2null "; #endif +string s_strIniPath="inis/SPU2null.ini"; FILE *spu2Log; Config conf; diff --git a/plugins/SPU2null/SPU2.h b/plugins/SPU2null/SPU2.h index 842ff27b85..4b6b1bf7b5 100644 --- a/plugins/SPU2null/SPU2.h +++ b/plugins/SPU2null/SPU2.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef __SPU2_H__ #define __SPU2_H__ diff --git a/plugins/USBnull/Linux/Config.cpp b/plugins/USBnull/Linux/Config.cpp index f7b43f4852..a931f6cfde 100644 --- a/plugins/USBnull/Linux/Config.cpp +++ b/plugins/USBnull/Linux/Config.cpp @@ -26,6 +26,9 @@ #include using namespace std; +#include "USB.h" +#include "Config.h" + #ifdef __cplusplus extern "C" { @@ -39,8 +42,6 @@ extern "C" } #endif -#include "USB.h" - GtkWidget *MsgDlg, *About, *Conf; extern string s_strIniPath; @@ -50,7 +51,7 @@ void OnMsg_Ok() gtk_main_quit(); } -void cfgSysMessage(char *fmt, ...) +void SysMessage(char *fmt, ...) { GtkWidget *Ok, *Txt; GtkWidget *Box, *Box1; @@ -98,7 +99,7 @@ void OnAbout_Ok(GtkButton *button, gpointer user_data) gtk_main_quit(); } -void CFGabout() +EXPORT_C_(void) USBabout() { About = create_About(); gtk_widget_show_all(About); @@ -107,6 +108,9 @@ void CFGabout() void OnConf_Ok(GtkButton *button, gpointer user_data) { + conf.Log = is_checked(Conf, "check_logging"); + SaveConfig(); + gtk_widget_destroy(Conf); gtk_main_quit(); } @@ -117,21 +121,16 @@ void OnConf_Cancel(GtkButton *button, gpointer user_data) gtk_main_quit(); } -void CFGconfigure() +EXPORT_C_(void) USBconfigure() { + LoadConfig(); Conf = create_Config(); + set_checked(Conf, "check_logging", conf.Log); gtk_widget_show_all(Conf); gtk_main(); } -long CFGmessage(char *msg) -{ - cfgSysMessage(msg); - - return 0; -} - void LoadConfig() { FILE *f; @@ -141,10 +140,11 @@ void LoadConfig() f = fopen(cfg, "r"); if (f == NULL) { - printf("failed to open %s\n", s_strIniPath.c_str()); + printf("failed to open '%s'\n", s_strIniPath.c_str()); SaveConfig();//save and return return; } + fscanf(f, "logging = %hhx\n", &conf.Log); //fscanf(f, "options = %hhx\n", &confOptions); fclose(f); } @@ -158,10 +158,11 @@ void SaveConfig() f = fopen(cfg,"w"); if (f == NULL) { - printf("failed to open %s\n", s_strIniPath.c_str()); + printf("failed to open '%s'\n", s_strIniPath.c_str()); return; } + fprintf(f, "logging = %hhx\n", conf.Log); //fprintf(f, "options = %hhx\n", confOptions); fclose(f); } diff --git a/plugins/USBnull/Linux/Config.h b/plugins/USBnull/Linux/Config.h index c4036d30ed..54fddc414f 100644 --- a/plugins/USBnull/Linux/Config.h +++ b/plugins/USBnull/Linux/Config.h @@ -18,7 +18,7 @@ void SaveConfig(); void LoadConfig(); -void cfgSysMessage(char *fmt, ...); -void CFGabout(); -void CFGconfigure(); -long CFGmessage(char *msg); +void SysMessage(char *fmt, ...); + +#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)))) +#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state) diff --git a/plugins/USBnull/Linux/Linux.cpp b/plugins/USBnull/Linux/Linux.cpp index 739a7a8162..8ab4944954 100644 --- a/plugins/USBnull/Linux/Linux.cpp +++ b/plugins/USBnull/Linux/Linux.cpp @@ -28,7 +28,7 @@ #include "USB.h" #include "Config.h" -void SysMessage(char *fmt, ...) +/*void SysMessage(char *fmt, ...) { va_list list; char msg[512]; @@ -39,9 +39,9 @@ void SysMessage(char *fmt, ...) va_end(list); cfgSysMessage(msg); -} +}*/ -void USBconfigure() +/*void USBconfigure() { CFGconfigure(); } @@ -49,5 +49,5 @@ void USBconfigure() void USBabout() { CFGabout(); -} +}*/ diff --git a/plugins/USBnull/Linux/interface.c b/plugins/USBnull/Linux/interface.c index 5c23358a21..0e304b63fe 100644 --- a/plugins/USBnull/Linux/interface.c +++ b/plugins/USBnull/Linux/interface.c @@ -31,28 +31,18 @@ create_Config (void) { GtkWidget *Config; GtkWidget *vbox1; - GtkWidget *frame2; - GtkWidget *hbox1; - GtkWidget *label4; - GtkWidget *GtkCombo_Eth; - GList *GtkCombo_Eth_items = NULL; - GtkWidget *combo_entry1; - GtkWidget *label1; GtkWidget *frame3; - GtkWidget *hbox2; - GtkWidget *label5; - GtkWidget *GtkCombo_Hdd; - GList *GtkCombo_Hdd_items = NULL; - GtkWidget *entry1; + GtkWidget *alignment1; + GtkWidget *check_logging; GtkWidget *label15; - GtkWidget *hbuttonbox1; - GtkWidget *button1; - GtkWidget *button2; + GtkWidget *hbuttonbox3; + GtkWidget *button4; + GtkWidget *button5; Config = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_name (Config, "Config"); gtk_container_set_border_width (GTK_CONTAINER (Config), 5); - gtk_window_set_title (GTK_WINDOW (Config), _("DEV9config")); + gtk_window_set_title (GTK_WINDOW (Config), _("USBconfig")); vbox1 = gtk_vbox_new (FALSE, 5); gtk_widget_set_name (vbox1, "vbox1"); @@ -60,121 +50,63 @@ create_Config (void) gtk_container_add (GTK_CONTAINER (Config), vbox1); gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5); - frame2 = gtk_frame_new (NULL); - gtk_widget_set_name (frame2, "frame2"); - gtk_widget_show (frame2); - gtk_box_pack_start (GTK_BOX (vbox1), frame2, TRUE, TRUE, 0); - - hbox1 = gtk_hbox_new (TRUE, 5); - gtk_widget_set_name (hbox1, "hbox1"); - gtk_widget_show (hbox1); - gtk_container_add (GTK_CONTAINER (frame2), hbox1); - gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5); - - label4 = gtk_label_new (_("Device:")); - gtk_widget_set_name (label4, "label4"); - gtk_widget_show (label4); - gtk_box_pack_start (GTK_BOX (hbox1), label4, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_CENTER); - - GtkCombo_Eth = gtk_combo_new (); - g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Eth)->popwin), - "GladeParentKey", GtkCombo_Eth); - gtk_widget_set_name (GtkCombo_Eth, "GtkCombo_Eth"); - gtk_widget_show (GtkCombo_Eth); - gtk_box_pack_start (GTK_BOX (hbox1), GtkCombo_Eth, FALSE, FALSE, 0); - GtkCombo_Eth_items = g_list_append (GtkCombo_Eth_items, (gpointer) ""); - gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Eth), GtkCombo_Eth_items); - g_list_free (GtkCombo_Eth_items); - - combo_entry1 = GTK_COMBO (GtkCombo_Eth)->entry; - gtk_widget_set_name (combo_entry1, "combo_entry1"); - gtk_widget_show (combo_entry1); - - label1 = gtk_label_new (_("Ethernet")); - gtk_widget_set_name (label1, "label1"); - gtk_widget_show (label1); - gtk_frame_set_label_widget (GTK_FRAME (frame2), label1); - frame3 = gtk_frame_new (NULL); gtk_widget_set_name (frame3, "frame3"); gtk_widget_show (frame3); gtk_box_pack_start (GTK_BOX (vbox1), frame3, TRUE, TRUE, 0); - hbox2 = gtk_hbox_new (TRUE, 5); - gtk_widget_set_name (hbox2, "hbox2"); - gtk_widget_show (hbox2); - gtk_container_add (GTK_CONTAINER (frame3), hbox2); - gtk_container_set_border_width (GTK_CONTAINER (hbox2), 5); + alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_set_name (alignment1, "alignment1"); + gtk_widget_show (alignment1); + gtk_container_add (GTK_CONTAINER (frame3), alignment1); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0); - label5 = gtk_label_new (_("Device:")); - gtk_widget_set_name (label5, "label5"); - gtk_widget_show (label5); - gtk_box_pack_start (GTK_BOX (hbox2), label5, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_CENTER); + check_logging = gtk_check_button_new_with_mnemonic (_("Enable Logging")); + gtk_widget_set_name (check_logging, "check_logging"); + gtk_widget_show (check_logging); + gtk_container_add (GTK_CONTAINER (alignment1), check_logging); - GtkCombo_Hdd = gtk_combo_new (); - g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Hdd)->popwin), - "GladeParentKey", GtkCombo_Hdd); - gtk_widget_set_name (GtkCombo_Hdd, "GtkCombo_Hdd"); - gtk_widget_show (GtkCombo_Hdd); - gtk_box_pack_start (GTK_BOX (hbox2), GtkCombo_Hdd, FALSE, FALSE, 0); - GtkCombo_Hdd_items = g_list_append (GtkCombo_Hdd_items, (gpointer) ""); - gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Hdd), GtkCombo_Hdd_items); - g_list_free (GtkCombo_Hdd_items); - - entry1 = GTK_COMBO (GtkCombo_Hdd)->entry; - gtk_widget_set_name (entry1, "entry1"); - gtk_widget_show (entry1); - - label15 = gtk_label_new (_("Hdd")); + label15 = gtk_label_new (_("Logging")); gtk_widget_set_name (label15, "label15"); gtk_widget_show (label15); gtk_frame_set_label_widget (GTK_FRAME (frame3), label15); + gtk_label_set_use_markup (GTK_LABEL (label15), TRUE); - hbuttonbox1 = gtk_hbutton_box_new (); - gtk_widget_set_name (hbuttonbox1, "hbuttonbox1"); - gtk_widget_show (hbuttonbox1); - gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0); - gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30); + hbuttonbox3 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox3, "hbuttonbox3"); + gtk_widget_show (hbuttonbox3); + gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox3, TRUE, TRUE, 0); + gtk_box_set_spacing (GTK_BOX (hbuttonbox3), 30); - button1 = gtk_button_new_with_mnemonic (_("Ok")); - gtk_widget_set_name (button1, "button1"); - gtk_widget_show (button1); - gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1); - GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT); + button4 = gtk_button_new_with_mnemonic (_("Ok")); + gtk_widget_set_name (button4, "button4"); + gtk_widget_show (button4); + gtk_container_add (GTK_CONTAINER (hbuttonbox3), button4); + GTK_WIDGET_SET_FLAGS (button4, GTK_CAN_DEFAULT); - button2 = gtk_button_new_with_mnemonic (_("Cancel")); - gtk_widget_set_name (button2, "button2"); - gtk_widget_show (button2); - gtk_container_add (GTK_CONTAINER (hbuttonbox1), button2); - GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT); + button5 = gtk_button_new_with_mnemonic (_("Cancel")); + gtk_widget_set_name (button5, "button5"); + gtk_widget_show (button5); + gtk_container_add (GTK_CONTAINER (hbuttonbox3), button5); + GTK_WIDGET_SET_FLAGS (button5, GTK_CAN_DEFAULT); - g_signal_connect ((gpointer) button1, "clicked", + g_signal_connect ((gpointer) button4, "clicked", G_CALLBACK (OnConf_Ok), NULL); - g_signal_connect ((gpointer) button2, "clicked", + g_signal_connect ((gpointer) button5, "clicked", G_CALLBACK (OnConf_Cancel), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config"); GLADE_HOOKUP_OBJECT (Config, vbox1, "vbox1"); - GLADE_HOOKUP_OBJECT (Config, frame2, "frame2"); - GLADE_HOOKUP_OBJECT (Config, hbox1, "hbox1"); - GLADE_HOOKUP_OBJECT (Config, label4, "label4"); - GLADE_HOOKUP_OBJECT (Config, GtkCombo_Eth, "GtkCombo_Eth"); - GLADE_HOOKUP_OBJECT (Config, combo_entry1, "combo_entry1"); - GLADE_HOOKUP_OBJECT (Config, label1, "label1"); GLADE_HOOKUP_OBJECT (Config, frame3, "frame3"); - GLADE_HOOKUP_OBJECT (Config, hbox2, "hbox2"); - GLADE_HOOKUP_OBJECT (Config, label5, "label5"); - GLADE_HOOKUP_OBJECT (Config, GtkCombo_Hdd, "GtkCombo_Hdd"); - GLADE_HOOKUP_OBJECT (Config, entry1, "entry1"); + GLADE_HOOKUP_OBJECT (Config, alignment1, "alignment1"); + GLADE_HOOKUP_OBJECT (Config, check_logging, "check_logging"); GLADE_HOOKUP_OBJECT (Config, label15, "label15"); - GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1"); - GLADE_HOOKUP_OBJECT (Config, button1, "button1"); - GLADE_HOOKUP_OBJECT (Config, button2, "button2"); + GLADE_HOOKUP_OBJECT (Config, hbuttonbox3, "hbuttonbox3"); + GLADE_HOOKUP_OBJECT (Config, button4, "button4"); + GLADE_HOOKUP_OBJECT (Config, button5, "button5"); return Config; } @@ -200,13 +132,13 @@ create_About (void) gtk_container_add (GTK_CONTAINER (About), vbox2); gtk_container_set_border_width (GTK_CONTAINER (vbox2), 5); - label2 = gtk_label_new (_("FireWire Driver")); + label2 = gtk_label_new (_("USB Null Driver")); gtk_widget_set_name (label2, "label2"); gtk_widget_show (label2); gtk_box_pack_start (GTK_BOX (vbox2), label2, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER); - label3 = gtk_label_new (_("Author: linuzappz ")); + label3 = gtk_label_new (_("Original Author: linuzappz \nRevised by arcum42@gmail.com.")); gtk_widget_set_name (label3, "label3"); gtk_widget_show (label3); gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0); diff --git a/plugins/USBnull/Linux/usbnull.glade b/plugins/USBnull/Linux/usbnull.glade index cef4eab65e..03afe746ac 100644 --- a/plugins/USBnull/Linux/usbnull.glade +++ b/plugins/USBnull/Linux/usbnull.glade @@ -6,7 +6,7 @@ 5 True - DEV9config + USBconfig GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -27,140 +27,6 @@ False 5 - - - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - 5 - True - True - 5 - - - - True - Device: - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - - - - 0 - False - False - - - - - - - - True - Ethernet - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - True - True - - - True @@ -169,98 +35,29 @@ GTK_SHADOW_ETCHED_IN - - 5 + True - True - 5 + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 - + True - Device: - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + True + Enable Logging + True + GTK_RELIEF_NORMAL + True + False + False + True - - 0 - False - False - - - - - - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - - - - 0 - False - False - @@ -268,9 +65,9 @@ True - Hdd + <b>Logging</b> False - False + True GTK_JUSTIFY_LEFT False False @@ -296,13 +93,13 @@ - + True GTK_BUTTONBOX_DEFAULT_STYLE 30 - + True True True @@ -315,7 +112,7 @@ - + True True True @@ -364,7 +161,7 @@ True - FireWire Driver + USB Null Driver False False GTK_JUSTIFY_CENTER @@ -389,7 +186,8 @@ True - Author: linuzappz <linuzappz@hotmail.com> + Original Author: linuzappz <linuzappz@hotmail.com> +Revised by arcum42@gmail.com. False False GTK_JUSTIFY_LEFT diff --git a/plugins/USBnull/USB.cpp b/plugins/USBnull/USB.cpp index 6aa6bab4bc..ba540e73a1 100644 --- a/plugins/USBnull/USB.cpp +++ b/plugins/USBnull/USB.cpp @@ -23,13 +23,13 @@ using namespace std; #include "USB.h" -string s_strIniPath; const unsigned char version = PS2E_USB_VERSION; const unsigned char revision = 0; const unsigned char build = 6; // increase that with each version static char *libraryName = "USBnull Driver"; +string s_strIniPath="inis/USBnull.ini"; //void (*USBirq)(); USBcallback USBirq; Config conf; diff --git a/plugins/dev9null/Linux/callbacks.c b/plugins/dev9null/Linux/callbacks.c new file mode 100644 index 0000000000..e87ed8be2d --- /dev/null +++ b/plugins/dev9null/Linux/callbacks.c @@ -0,0 +1,34 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + + +void +OnConf_Ok (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnConf_Cancel (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnAbout_Ok (GtkButton *button, + gpointer user_data) +{ + +} + diff --git a/plugins/dev9null/Linux/callbacks.h b/plugins/dev9null/Linux/callbacks.h new file mode 100644 index 0000000000..e606c242f0 --- /dev/null +++ b/plugins/dev9null/Linux/callbacks.h @@ -0,0 +1,14 @@ +#include + + +void +OnConf_Ok (GtkButton *button, + gpointer user_data); + +void +OnConf_Cancel (GtkButton *button, + gpointer user_data); + +void +OnAbout_Ok (GtkButton *button, + gpointer user_data); diff --git a/plugins/dev9null/Linux/dev9.glade b/plugins/dev9null/Linux/dev9.glade new file mode 100644 index 0000000000..10b8a7f4d1 --- /dev/null +++ b/plugins/dev9null/Linux/dev9.glade @@ -0,0 +1,444 @@ + + + + + + + 5 + True + DEV9config + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + 5 + True + False + 5 + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + 5 + True + True + 5 + + + + True + Device: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + False + True + False + True + False + + + + True + True + True + True + 0 + + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + True + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + + + + + 0 + False + False + + + + + + + + True + Ethernet + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + 5 + True + True + 5 + + + + True + Device: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + False + True + False + True + False + + + + True + True + True + True + 0 + + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + True + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + + + + + 0 + False + False + + + + + + + + True + Hdd + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 30 + + + + True + True + True + Ok + True + GTK_RELIEF_NORMAL + True + + + + + + + True + True + True + Cancel + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + True + True + + + + + + + + 5 + True + DEV9about + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + 5 + True + False + 5 + + + + True + Dev9 null Driver + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + Original Author: linuzappz <linuzappz@hotmail.com> +Revised by arcum42@gmail.com + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + GTK_BUTTONBOX_DEFAULT_STYLE + 30 + + + + True + True + True + Ok + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + True + True + + + + + + + diff --git a/plugins/dev9null/Linux/interface.c b/plugins/dev9null/Linux/interface.c new file mode 100644 index 0000000000..eef82eaf94 --- /dev/null +++ b/plugins/dev9null/Linux/interface.c @@ -0,0 +1,240 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#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_Config (void) +{ + GtkWidget *Config; + GtkWidget *vbox1; + GtkWidget *frame2; + GtkWidget *hbox1; + GtkWidget *label4; + GtkWidget *GtkCombo_Eth; + GList *GtkCombo_Eth_items = NULL; + GtkWidget *combo_entry1; + GtkWidget *label1; + GtkWidget *frame3; + GtkWidget *hbox2; + GtkWidget *label5; + GtkWidget *GtkCombo_Hdd; + GList *GtkCombo_Hdd_items = NULL; + GtkWidget *entry1; + GtkWidget *label15; + GtkWidget *hbuttonbox1; + GtkWidget *button1; + GtkWidget *button2; + + Config = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name (Config, "Config"); + gtk_container_set_border_width (GTK_CONTAINER (Config), 5); + gtk_window_set_title (GTK_WINDOW (Config), _("DEV9config")); + + vbox1 = gtk_vbox_new (FALSE, 5); + gtk_widget_set_name (vbox1, "vbox1"); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (Config), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5); + + frame2 = gtk_frame_new (NULL); + gtk_widget_set_name (frame2, "frame2"); + gtk_widget_show (frame2); + gtk_box_pack_start (GTK_BOX (vbox1), frame2, TRUE, TRUE, 0); + + hbox1 = gtk_hbox_new (TRUE, 5); + gtk_widget_set_name (hbox1, "hbox1"); + gtk_widget_show (hbox1); + gtk_container_add (GTK_CONTAINER (frame2), hbox1); + gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5); + + label4 = gtk_label_new (_("Device:")); + gtk_widget_set_name (label4, "label4"); + gtk_widget_show (label4); + gtk_box_pack_start (GTK_BOX (hbox1), label4, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_CENTER); + + GtkCombo_Eth = gtk_combo_new (); + g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Eth)->popwin), + "GladeParentKey", GtkCombo_Eth); + gtk_widget_set_name (GtkCombo_Eth, "GtkCombo_Eth"); + gtk_widget_show (GtkCombo_Eth); + gtk_box_pack_start (GTK_BOX (hbox1), GtkCombo_Eth, FALSE, FALSE, 0); + GtkCombo_Eth_items = g_list_append (GtkCombo_Eth_items, (gpointer) ""); + gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Eth), GtkCombo_Eth_items); + g_list_free (GtkCombo_Eth_items); + + combo_entry1 = GTK_COMBO (GtkCombo_Eth)->entry; + gtk_widget_set_name (combo_entry1, "combo_entry1"); + gtk_widget_show (combo_entry1); + + label1 = gtk_label_new (_("Ethernet")); + gtk_widget_set_name (label1, "label1"); + gtk_widget_show (label1); + gtk_frame_set_label_widget (GTK_FRAME (frame2), label1); + + frame3 = gtk_frame_new (NULL); + gtk_widget_set_name (frame3, "frame3"); + gtk_widget_show (frame3); + gtk_box_pack_start (GTK_BOX (vbox1), frame3, TRUE, TRUE, 0); + + hbox2 = gtk_hbox_new (TRUE, 5); + gtk_widget_set_name (hbox2, "hbox2"); + gtk_widget_show (hbox2); + gtk_container_add (GTK_CONTAINER (frame3), hbox2); + gtk_container_set_border_width (GTK_CONTAINER (hbox2), 5); + + label5 = gtk_label_new (_("Device:")); + gtk_widget_set_name (label5, "label5"); + gtk_widget_show (label5); + gtk_box_pack_start (GTK_BOX (hbox2), label5, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_CENTER); + + GtkCombo_Hdd = gtk_combo_new (); + g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Hdd)->popwin), + "GladeParentKey", GtkCombo_Hdd); + gtk_widget_set_name (GtkCombo_Hdd, "GtkCombo_Hdd"); + gtk_widget_show (GtkCombo_Hdd); + gtk_box_pack_start (GTK_BOX (hbox2), GtkCombo_Hdd, FALSE, FALSE, 0); + GtkCombo_Hdd_items = g_list_append (GtkCombo_Hdd_items, (gpointer) ""); + gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Hdd), GtkCombo_Hdd_items); + g_list_free (GtkCombo_Hdd_items); + + entry1 = GTK_COMBO (GtkCombo_Hdd)->entry; + gtk_widget_set_name (entry1, "entry1"); + gtk_widget_show (entry1); + + label15 = gtk_label_new (_("Hdd")); + gtk_widget_set_name (label15, "label15"); + gtk_widget_show (label15); + gtk_frame_set_label_widget (GTK_FRAME (frame3), label15); + + hbuttonbox1 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox1, "hbuttonbox1"); + gtk_widget_show (hbuttonbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0); + gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30); + + button1 = gtk_button_new_with_mnemonic (_("Ok")); + gtk_widget_set_name (button1, "button1"); + gtk_widget_show (button1); + gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1); + GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT); + + button2 = gtk_button_new_with_mnemonic (_("Cancel")); + gtk_widget_set_name (button2, "button2"); + gtk_widget_show (button2); + gtk_container_add (GTK_CONTAINER (hbuttonbox1), button2); + GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT); + + g_signal_connect ((gpointer) button1, "clicked", + G_CALLBACK (OnConf_Ok), + NULL); + g_signal_connect ((gpointer) button2, "clicked", + G_CALLBACK (OnConf_Cancel), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config"); + GLADE_HOOKUP_OBJECT (Config, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (Config, frame2, "frame2"); + GLADE_HOOKUP_OBJECT (Config, hbox1, "hbox1"); + GLADE_HOOKUP_OBJECT (Config, label4, "label4"); + GLADE_HOOKUP_OBJECT (Config, GtkCombo_Eth, "GtkCombo_Eth"); + GLADE_HOOKUP_OBJECT (Config, combo_entry1, "combo_entry1"); + GLADE_HOOKUP_OBJECT (Config, label1, "label1"); + GLADE_HOOKUP_OBJECT (Config, frame3, "frame3"); + GLADE_HOOKUP_OBJECT (Config, hbox2, "hbox2"); + GLADE_HOOKUP_OBJECT (Config, label5, "label5"); + GLADE_HOOKUP_OBJECT (Config, GtkCombo_Hdd, "GtkCombo_Hdd"); + GLADE_HOOKUP_OBJECT (Config, entry1, "entry1"); + GLADE_HOOKUP_OBJECT (Config, label15, "label15"); + GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1"); + GLADE_HOOKUP_OBJECT (Config, button1, "button1"); + GLADE_HOOKUP_OBJECT (Config, button2, "button2"); + + return Config; +} + +GtkWidget* +create_About (void) +{ + GtkWidget *About; + GtkWidget *vbox2; + GtkWidget *label2; + GtkWidget *label3; + GtkWidget *hbuttonbox2; + GtkWidget *button3; + + About = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name (About, "About"); + gtk_container_set_border_width (GTK_CONTAINER (About), 5); + gtk_window_set_title (GTK_WINDOW (About), _("DEV9about")); + + vbox2 = gtk_vbox_new (FALSE, 5); + gtk_widget_set_name (vbox2, "vbox2"); + gtk_widget_show (vbox2); + gtk_container_add (GTK_CONTAINER (About), vbox2); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 5); + + label2 = gtk_label_new (_("Dev9 null Driver")); + gtk_widget_set_name (label2, "label2"); + gtk_widget_show (label2); + gtk_box_pack_start (GTK_BOX (vbox2), label2, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER); + + label3 = gtk_label_new (_("Original Author: linuzappz \nRevised by arcum42@gmail.com")); + gtk_widget_set_name (label3, "label3"); + gtk_widget_show (label3); + gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0); + + hbuttonbox2 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox2, "hbuttonbox2"); + gtk_widget_show (hbuttonbox2); + gtk_box_pack_start (GTK_BOX (vbox2), hbuttonbox2, TRUE, TRUE, 0); + gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 30); + + button3 = gtk_button_new_with_mnemonic (_("Ok")); + gtk_widget_set_name (button3, "button3"); + gtk_widget_show (button3); + gtk_container_add (GTK_CONTAINER (hbuttonbox2), button3); + GTK_WIDGET_SET_FLAGS (button3, GTK_CAN_DEFAULT); + + g_signal_connect ((gpointer) button3, "clicked", + G_CALLBACK (OnAbout_Ok), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (About, About, "About"); + GLADE_HOOKUP_OBJECT (About, vbox2, "vbox2"); + GLADE_HOOKUP_OBJECT (About, label2, "label2"); + GLADE_HOOKUP_OBJECT (About, label3, "label3"); + GLADE_HOOKUP_OBJECT (About, hbuttonbox2, "hbuttonbox2"); + GLADE_HOOKUP_OBJECT (About, button3, "button3"); + + return About; +} + diff --git a/plugins/dev9null/Linux/interface.h b/plugins/dev9null/Linux/interface.h new file mode 100644 index 0000000000..69c303ba3b --- /dev/null +++ b/plugins/dev9null/Linux/interface.h @@ -0,0 +1,6 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +GtkWidget* create_Config (void); +GtkWidget* create_About (void); diff --git a/plugins/dev9null/Linux/support.c b/plugins/dev9null/Linux/support.c new file mode 100644 index 0000000000..00aff29822 --- /dev/null +++ b/plugins/dev9null/Linux/support.c @@ -0,0 +1,144 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include + +#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); + } +} + diff --git a/plugins/dev9null/Linux/support.h b/plugins/dev9null/Linux/support.h new file mode 100644 index 0000000000..a32649e53c --- /dev/null +++ b/plugins/dev9null/Linux/support.h @@ -0,0 +1,69 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +/* + * Standard gettext macros. + */ +#ifdef ENABLE_NLS +# include +# undef _ +# define _(String) dgettext (PACKAGE, String) +# define Q_(String) g_strip_context ((String), gettext (String)) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif +#else +# define textdomain(String) (String) +# define gettext(String) (String) +# define dgettext(Domain,Message) (Message) +# define dcgettext(Domain,Message,Type) (Message) +# define bindtextdomain(Domain,Directory) (Domain) +# define _(String) (String) +# define Q_(String) g_strip_context ((String), (String)) +# define N_(String) (String) +#endif + + +/* + * 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); + diff --git a/plugins/zeropad/Linux/callbacks.c b/plugins/zeropad/Linux/callbacks.c index e3a92ed51e..cb65ceeb21 100644 --- a/plugins/zeropad/Linux/callbacks.c +++ b/plugins/zeropad/Linux/callbacks.c @@ -112,3 +112,12 @@ OnConf_Ok (GtkButton *button, } + +void +OnAbout_Ok (GtkDialog *dialog, + gint response_id, + gpointer user_data) +{ + +} + diff --git a/plugins/zeropad/Linux/callbacks.h b/plugins/zeropad/Linux/callbacks.h index d9c6d64ae1..3e57b0e5d4 100644 --- a/plugins/zeropad/Linux/callbacks.h +++ b/plugins/zeropad/Linux/callbacks.h @@ -52,3 +52,8 @@ OnConf_Cancel (GtkButton *button, void OnConf_Ok (GtkButton *button, gpointer user_data); + +void +OnAbout_Ok (GtkDialog *dialog, + gint response_id, + gpointer user_data); diff --git a/plugins/zeropad/Linux/gui.cpp b/plugins/zeropad/Linux/gui.cpp index 0111b4a6d4..199da357a3 100644 --- a/plugins/zeropad/Linux/gui.cpp +++ b/plugins/zeropad/Linux/gui.cpp @@ -270,9 +270,10 @@ void OnConf_Cancel(GtkButton *button, gpointer user_data) GtkWidget *About = NULL; -void OnAbout_Ok(GtkButton *button, gpointer user_data) +//void OnAbout_Ok(GtkButton *button, gpointer user_data) +void OnAbout_Ok(GtkDialog *About, gint response_id, gpointer user_data) { - gtk_widget_destroy(About); + gtk_widget_destroy(GTK_WIDGET(About)); gtk_main_quit(); } diff --git a/plugins/zeropad/Linux/interface.c b/plugins/zeropad/Linux/interface.c index 808afbc3e6..d8e669e802 100644 --- a/plugins/zeropad/Linux/interface.c +++ b/plugins/zeropad/Linux/interface.c @@ -44,11 +44,16 @@ create_About (void) About = gtk_about_dialog_new (); gtk_widget_set_name (About, "About"); gtk_container_set_border_width (GTK_CONTAINER (About), 5); + gtk_window_set_destroy_with_parent (GTK_WINDOW (About), TRUE); gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (About), VERSION); gtk_about_dialog_set_name (GTK_ABOUT_DIALOG (About), _("ZeroPAD")); gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (About), authors); gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG (About), translators); + g_signal_connect ((gpointer) About, "response", + G_CALLBACK (OnAbout_Ok), + NULL); + /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (About, About, "About"); diff --git a/plugins/zeropad/Linux/zeropad.glade b/plugins/zeropad/Linux/zeropad.glade index c8fc069ca7..ef754e23a4 100644 --- a/plugins/zeropad/Linux/zeropad.glade +++ b/plugins/zeropad/Linux/zeropad.glade @@ -6,7 +6,7 @@ 5 True - False + True ZeroPAD False Author: zerofrog(@gmail.com) @@ -15,6 +15,7 @@ Thanks to: florin sasu <florinsasu@hotmail.com> and SSSPSXPad, TwinPad authors translator-credits +