Use theme icons instead of the old clunky ones
authorAlexander Koenig <alex@lisas.de>
Fri, 21 Feb 2020 20:21:30 +0000 (21:21 +0100)
committerAlexander Koenig <alex@lisas.de>
Fri, 21 Feb 2020 20:21:30 +0000 (21:21 +0100)
src/tX_mastergui.cc
src/tX_pbutton.cc

index 74e5bc7212f0d4e92072aed4bfaab0927147b8f7..581c87d4b9b67a07aea6662119e4b3c978bfdef3 100644 (file)
@@ -120,6 +120,7 @@ GtkWidget *fullscreen_item;
 GdkWindow* top_window;
 #define WID_DYN TRUE, TRUE, 0
 #define WID_FIX FALSE, FALSE, 0
+#define WID_FIX_BREATHE FALSE, FALSE, 5
 extern void add_vtt(GtkWidget *ctrl, GtkWidget *audio, char *fn);
 extern void destroy_gui(vtt_class *vtt);
 extern void gui_show_focus(vtt_class *vtt, int show);
@@ -1367,7 +1368,7 @@ void create_mastergui(int x, int y)
     /* control_box contents */
 
        dummy=tx_xpm_label_box(AUDIOENGINE, "Audio");
-       gtk_box_pack_start(GTK_BOX(control_box), dummy, WID_FIX);
+       gtk_box_pack_start(GTK_BOX(control_box), dummy, WID_FIX_BREATHE);
        gtk_widget_show(dummy);
        
        dummy=tx_xpm_button_new(POWER,"Power ", 1);
@@ -1388,7 +1389,7 @@ void create_mastergui(int x, int y)
        gtk_widget_show(dummy);
     
        dummy=tx_xpm_label_box(SEQUENCER, "Seq.");
-       gtk_box_pack_start(GTK_BOX(control_box), dummy, WID_FIX);
+       gtk_box_pack_start(GTK_BOX(control_box), dummy, WID_FIX_BREATHE);
        gtk_widget_show(dummy);
 
        dummy=tx_xpm_button_new(PLAY,"Play ", 1);
index 97669db8d104a52943d925c03ce786e80dfea025..d8c2b0597394eab59df1db5580886aab4f1a7ba6 100644 (file)
 
 #include "icons/tX_icons_resources.c"
 
-char tx_icons[ALL_ICONS][256];
-int tx_icon_size=20;
+const char* tx_icons[ALL_ICONS];
 
-#define icon_init(id, name) { snprintf(tx_icons[id], 256, "/org/terminatorX/tX_pbutton/%s.svg", name); }
+int tx_icon_size=20;
 
 void tx_icons_init(int size) 
 {
        tx_icon_size=size;
 
-       GError *error = NULL;
-       g_resource_new_from_data(g_bytes_new_static(tX_icons_resource_data.data, sizeof(tX_icons_resource_data.data)), &error);
-       if (error) {
-         tX_error("failed accessing tX_icons resources: %s", error->message);
-       }
+       tx_icons[AUDIOENGINE] = "audio-speakers-symbolic";
+       tx_icons[POWER] = "system-shutdown-symbolic";
+       tx_icons[GRAB] = "input-mouse-symbolic";        
 
-       icon_init(AUDIOENGINE, "audioengine");
-       icon_init(POWER, "power");
-       icon_init(GRAB, "grab");
-       icon_init(SEQUENCER, "sequencer");
-       icon_init(PLAY, "play");
-       icon_init(STOP, "stop");
-       icon_init(RECORD, "record");
-       icon_init(MIN_AUDIO, "samples");
-       icon_init(MIN_CONTROL, "control");
-       icon_init(MINIMIZE, "minimize");
-       icon_init(MAXIMIZE, "maximize");
-       icon_init(FX_UP, "fx_up");
-       icon_init(FX_DOWN, "fx_down");
-       icon_init(FX_CLOSE, "fx_close");
-       icon_init(MINIMIZE_PANEL, "minimize_panel");
+       tx_icons[SEQUENCER] = "emblem-music-symbolic";
+       
+       tx_icons[PLAY] = "media-playback-start-symbolic";
+       tx_icons[STOP] = "media-playback-stop-symbolic";
+       tx_icons[RECORD] = "media-record-symbolic";
+       tx_icons[MIN_AUDIO] = "audio-x-generic-symbolic";
+       tx_icons[MIN_CONTROL] = "multimedia-volume-control-symbolic";
+       
+       tx_icons[MINIMIZE] = "go-top-symbolic";
+       tx_icons[MAXIMIZE] = "go-bottom-symbolic";
+       tx_icons[FX_UP] = "go-up-symbolic";
+       tx_icons[FX_DOWN] = "go-down-symbolic";
+       tx_icons[FX_CLOSE] = "window-close-symbolic";
+       tx_icons[MINIMIZE_PANEL] = "window-minimize-symbolic";
 }
 
 GtkWidget *tx_pixmap_widget(tX_icon id)
 {
-       GError *error = NULL;
-       GtkWidget *widget=gtk_image_new();
-       GdkPixbuf *pixbuf=gdk_pixbuf_new_from_resource_at_scale(tx_icons[id], tx_icon_size, tx_icon_size, TRUE, &error);
-       if (error) {
-               tX_error("failed rendering icon to pixbuf: %s", error->message);
-       } else {
-               gtk_image_set_from_pixbuf(GTK_IMAGE(widget), pixbuf);
-       }
-
-  return widget;
+       return gtk_image_new_from_icon_name (tx_icons[id], GTK_ICON_SIZE_SMALL_TOOLBAR);
 }
 
 GtkWidget *tx_xpm_label_box(tX_icon id, const gchar *label_text, GtkWidget **labelwidget)