[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 13/41: Replace GtkAlignment in profile picture.

noreply at xfce.org noreply at xfce.org
Sat Aug 20 18:32:27 CEST 2016


This is an automated email from the git hooks/post-receive script.

gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit a7c2a6640e68e56f3e1868018eb8b814a87125b5
Author: Graeme Gott <graeme at gottcode.org>
Date:   Mon Aug 8 10:37:44 2016 -0400

    Replace GtkAlignment in profile picture.
---
 panel-plugin/profile-picture.cpp | 21 +++++++++++----------
 panel-plugin/profile-picture.h   |  6 +++---
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/panel-plugin/profile-picture.cpp b/panel-plugin/profile-picture.cpp
index b70fd41..348fd7f 100644
--- a/panel-plugin/profile-picture.cpp
+++ b/panel-plugin/profile-picture.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2014, 2016 Graeme Gott <graeme at gottcode.org>
  *
  * This library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,11 +33,16 @@ ProfilePicture::ProfilePicture(Window* window) :
 {
 	m_image = xfce_panel_image_new();
 
-	GtkWidget* eventbox = gtk_event_box_new();
-	gtk_event_box_set_visible_window(GTK_EVENT_BOX(eventbox), false);
-	gtk_widget_add_events(eventbox, GDK_BUTTON_PRESS_MASK);
-	g_signal_connect_slot<GtkWidget*, GdkEvent*>(eventbox, "button-press-event", &ProfilePicture::on_button_press_event, this);
-	gtk_container_add(GTK_CONTAINER(eventbox), m_image);
+	gtk_widget_set_halign(m_image, GTK_ALIGN_CENTER);
+	gtk_widget_set_valign(m_image, GTK_ALIGN_CENTER);
+	gtk_widget_set_margin_start(m_image, 10);
+	gtk_widget_set_margin_end(m_image, 10);
+
+	m_container = gtk_event_box_new();
+	gtk_event_box_set_visible_window(GTK_EVENT_BOX(m_container), false);
+	gtk_widget_add_events(m_container, GDK_BUTTON_PRESS_MASK);
+	g_signal_connect_slot<GtkWidget*, GdkEvent*>(m_container, "button-press-event", &ProfilePicture::on_button_press_event, this);
+	gtk_container_add(GTK_CONTAINER(m_container), m_image);
 
 	gchar* path = g_build_filename(g_get_home_dir(), ".face", NULL);
 	GFile* file = g_file_new_for_path(path);
@@ -48,10 +53,6 @@ ProfilePicture::ProfilePicture(Window* window) :
 	on_file_changed(m_file_monitor, file, NULL, G_FILE_MONITOR_EVENT_CHANGED);
 
 	g_object_unref(file);
-
-	m_alignment = gtk_alignment_new(0.5, 0.5, 0, 0);
-	gtk_alignment_set_padding(GTK_ALIGNMENT(m_alignment), 0, 0, 10, 10);
-	gtk_container_add(GTK_CONTAINER(m_alignment), eventbox);
 }
 
 //-----------------------------------------------------------------------------
diff --git a/panel-plugin/profile-picture.h b/panel-plugin/profile-picture.h
index e70a0c6..6593978 100644
--- a/panel-plugin/profile-picture.h
+++ b/panel-plugin/profile-picture.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2014, 2016 Graeme Gott <graeme at gottcode.org>
  *
  * This library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ public:
 
 	GtkWidget* get_widget() const
 	{
-		return m_alignment;
+		return m_container;
 	}
 
 private:
@@ -42,7 +42,7 @@ private:
 
 private:
 	Window* m_window;
-	GtkWidget* m_alignment;
+	GtkWidget* m_container;
 	GtkWidget* m_image;
 	GFileMonitor* m_file_monitor;
 };

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list