aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2020-07-28 18:39:55 +0200
committerRobert Tari <robert@tari.in>2020-07-28 18:39:55 +0200
commitf937570ca3eb47233e407651f5a5231bd3b205f5 (patch)
treef0d6beaf8c1a5bff9fc54ae708eaea999acb7e6f /src
parentfac3c960acc91c03129ae3a37999a3c8edce4bf2 (diff)
downloadayatana-ido-f937570ca3eb47233e407651f5a5231bd3b205f5.tar.gz
ayatana-ido-f937570ca3eb47233e407651f5a5231bd3b205f5.tar.bz2
ayatana-ido-f937570ca3eb47233e407651f5a5231bd3b205f5.zip
Centre volume control/Stretch calendar horizontally
Diffstat (limited to 'src')
-rw-r--r--src/idocalendarmenuitem.c100
-rw-r--r--src/idoscalemenuitem.c3
2 files changed, 52 insertions, 51 deletions
diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c
index f3881bc..938dc14 100644
--- a/src/idocalendarmenuitem.c
+++ b/src/idocalendarmenuitem.c
@@ -45,12 +45,12 @@ static void calendar_realized_cb (GtkWidget *widg
static void calendar_move_focus_cb (GtkWidget *widget,
GtkDirectionType direction,
IdoCalendarMenuItem *item);
-static void calendar_month_changed_cb (GtkWidget *widget,
- gpointer user_data);
-static void calendar_day_selected_double_click_cb (GtkWidget *widget,
+static void calendar_month_changed_cb (GtkWidget *widget,
+ gpointer user_data);
+static void calendar_day_selected_double_click_cb (GtkWidget *widget,
+ gpointer user_data);
+static void calendar_day_selected_cb (GtkWidget *widget,
gpointer user_data);
-static void calendar_day_selected_cb (GtkWidget *widget,
- gpointer user_data);
typedef struct {
GtkWidget *box;
GtkWidget *calendar;
@@ -118,7 +118,7 @@ ido_calendar_menu_item_init (IdoCalendarMenuItem *item)
priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start (GTK_BOX (priv->box), priv->calendar, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->box), priv->calendar, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (item), priv->box);
@@ -209,53 +209,53 @@ static gboolean
ido_calendar_menu_item_button_press (GtkWidget *widget,
GdkEventButton *event)
{
- IdoCalendarMenuItem *menuitem = IDO_CALENDAR_MENU_ITEM (widget);
- IdoCalendarMenuItemPrivate *priv = ido_calendar_menu_item_get_instance_private(menuitem);
+ IdoCalendarMenuItem *menuitem = IDO_CALENDAR_MENU_ITEM (widget);
+ IdoCalendarMenuItemPrivate *priv = ido_calendar_menu_item_get_instance_private(menuitem);
- GtkWidget *calendar = priv->calendar;
+ GtkWidget *calendar = priv->calendar;
- if (event->button == 1) {
- if (gtk_widget_get_window (calendar) != NULL) {
- gdk_window_raise (gtk_widget_get_window (calendar));
- }
+ if (event->button == 1) {
+ if (gtk_widget_get_window (calendar) != NULL) {
+ gdk_window_raise (gtk_widget_get_window (calendar));
+ }
- if (!gtk_widget_has_focus (calendar)) {
- gtk_widget_grab_focus (calendar);
- }
+ if (!gtk_widget_has_focus (calendar)) {
+ gtk_widget_grab_focus (calendar);
+ }
- GdkEvent * newevent = gdk_event_copy((GdkEvent *)(event));
- GList * children = gdk_window_get_children(gtk_widget_get_window(calendar));
- GList * child;
+ GdkEvent * newevent = gdk_event_copy((GdkEvent *)(event));
+ GList * children = gdk_window_get_children(gtk_widget_get_window(calendar));
+ GList * child;
- gint root_x = event->x_root;
- gint root_y = event->y_root;
+ gint root_x = event->x_root;
+ gint root_y = event->y_root;
- for (child = children; child != NULL; child = g_list_next(child)) {
- gint newx, newy;
- gint winx, winy;
- GdkWindow * newwindow = (GdkWindow*)child->data;
+ for (child = children; child != NULL; child = g_list_next(child)) {
+ gint newx, newy;
+ gint winx, winy;
+ GdkWindow * newwindow = (GdkWindow*)child->data;
- ((GdkEventButton *)newevent)->window = newwindow;
+ ((GdkEventButton *)newevent)->window = newwindow;
- gdk_window_get_origin(newwindow, &winx, &winy);
- newx = root_x - winx;
- newy = root_y - winy;
+ gdk_window_get_origin(newwindow, &winx, &winy);
+ newx = root_x - winx;
+ newy = root_y - winy;
- if (newx >= 0 && newy >= 0 && newx < gdk_window_get_width(newwindow) && newy < gdk_window_get_height(newwindow)) {
- ((GdkEventButton *)newevent)->x = newx;
- ((GdkEventButton *)newevent)->y = newy;
+ if (newx >= 0 && newy >= 0 && newx < gdk_window_get_width(newwindow) && newy < gdk_window_get_height(newwindow)) {
+ ((GdkEventButton *)newevent)->x = newx;
+ ((GdkEventButton *)newevent)->y = newy;
- GTK_WIDGET_GET_CLASS(calendar)->button_press_event(GTK_WIDGET(calendar), (GdkEventButton*)newevent);
- }
- }
+ GTK_WIDGET_GET_CLASS(calendar)->button_press_event(GTK_WIDGET(calendar), (GdkEventButton*)newevent);
+ }
+ }
- ((GdkEventButton *)newevent)->window = event->window;
- gdk_event_free(newevent);
+ ((GdkEventButton *)newevent)->window = event->window;
+ gdk_event_free(newevent);
- return TRUE;
- }
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
static gboolean
@@ -346,7 +346,7 @@ calendar_move_focus_cb (GtkWidget *widget,
}
static void
-calendar_month_changed_cb (GtkWidget *widget,
+calendar_month_changed_cb (GtkWidget *widget,
gpointer user_data)
{
IdoCalendarMenuItem *item = (IdoCalendarMenuItem *)user_data;
@@ -354,7 +354,7 @@ calendar_month_changed_cb (GtkWidget *widget,
}
static void
-calendar_day_selected_cb (GtkWidget *widget,
+calendar_day_selected_cb (GtkWidget *widget,
gpointer user_data)
{
IdoCalendarMenuItem *item = (IdoCalendarMenuItem *)user_data;
@@ -362,7 +362,7 @@ calendar_day_selected_cb (GtkWidget *widget,
}
static void
-calendar_day_selected_double_click_cb (GtkWidget *widget,
+calendar_day_selected_double_click_cb (GtkWidget *widget,
gpointer user_data)
{
IdoCalendarMenuItem *item = (IdoCalendarMenuItem *)user_data;
@@ -407,12 +407,12 @@ ido_calendar_menu_item_get_calendar (IdoCalendarMenuItem *menuitem)
* @menuitem: A #IdoCalendarMenuItem
* @day: the day number to unmark between 1 and 31.
*
- * Places a visual marker on a particular day.
+ * Places a visual marker on a particular day.
*
* Return Value: #TRUE
*/
gboolean
-ido_calendar_menu_item_mark_day (IdoCalendarMenuItem *menuitem, guint day)
+ido_calendar_menu_item_mark_day (IdoCalendarMenuItem *menuitem, guint day)
{
g_return_val_if_fail(IDO_IS_CALENDAR_MENU_ITEM(menuitem), FALSE);
@@ -426,7 +426,7 @@ ido_calendar_menu_item_mark_day (IdoCalendarMenuItem *menuitem, guint day)
* ido_calendar_menu_item_unmark_day:
* @menuitem: A #IdoCalendarMenuItem
* @day: the day number to unmark between 1 and 31.
- *
+ *
* Removes the visual marker from a particular day.
*
* Return Value: #TRUE
@@ -446,7 +446,7 @@ ido_calendar_menu_item_unmark_day (IdoCalendarMenuItem *menuitem, guint day)
* ido_calendar_menu_item_clear_marks:
* @menuitem: A #IdoCalendarMenuItem
*
- * Remove all visual markers.
+ * Remove all visual markers.
*/
void
ido_calendar_menu_item_clear_marks (IdoCalendarMenuItem *menuitem)
@@ -502,7 +502,7 @@ ido_calendar_menu_item_get_display_options (IdoCalendarMenuItem *menuitem)
*
* Gets the selected date.
*/
-void
+void
ido_calendar_menu_item_get_date (IdoCalendarMenuItem *menuitem,
guint *year,
guint *month,
@@ -574,10 +574,10 @@ activate_current_day (IdoCalendarMenuItem * ido_calendar,
GVariant * target;
ido_calendar_menu_item_get_date (ido_calendar, &y, &m, &d);
- m++; /* adjust month from GtkCalendar (0 based) to GDateTime (1 based) */
+ m++;
date_time = g_date_time_new_local (y, m, d, 9, 0, 0);
target = g_variant_new_int64 (g_date_time_to_unix (date_time));
-
+
g_action_group_activate_action (action_group, action_name, target);
g_date_time_unref (date_time);
diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c
index 9f5f29c..17bf44b 100644
--- a/src/idoscalemenuitem.c
+++ b/src/idoscalemenuitem.c
@@ -169,6 +169,7 @@ ido_scale_menu_item_constructed (GObject *object)
gtk_scale_set_draw_value (GTK_SCALE (priv->scale), FALSE);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_widget_set_margin_end(hbox, 16);
priv->primary_image = gtk_image_new ();
g_signal_connect (priv->primary_image, "notify",
@@ -253,7 +254,7 @@ ido_scale_menu_item_class_init (IdoScaleMenuItemClass *item_class)
* IdoScaleMenuItem::slider-grabbed:
* @menuitem: The #IdoScaleMenuItem emitting the signal.
*
- * The ::slider-grabbed signal is emitted when the pointer selects the slider.
+ * The ::slider-grabbed signal is emitted when the pointer selects the slider.
*/
signals[SLIDER_GRABBED] = g_signal_new ("slider-grabbed",
G_OBJECT_CLASS_TYPE (gobject_class),