[gtranslator/gtk4: 28/79] replaced GtkBin with GtkFrame in GtrDlTeams and replaced GtkMenuButton with GtkButton in GtrFilterSe




commit c15eddeaddf2c74b78e31692e8f42ad95a1b7dcf
Author: afshan ahmed khan <afshanahmeda2k gmail com>
Date:   Thu Jun 2 19:15:53 2022 +0530

    replaced GtkBin with GtkFrame in GtrDlTeams and replaced GtkMenuButton with GtkButton in 
GtrFilterSelection

 src/gtr-dl-teams.c          |  4 ++--
 src/gtr-dl-teams.h          |  2 +-
 src/gtr-dl-teams.ui         |  2 +-
 src/gtr-filter-selection.c  | 16 +++++++++++++++-
 src/gtr-filter-selection.h  |  4 ++--
 src/gtr-filter-selection.ui |  4 ++--
 6 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/src/gtr-dl-teams.c b/src/gtr-dl-teams.c
index b2d32bb0..94a94769 100644
--- a/src/gtr-dl-teams.c
+++ b/src/gtr-dl-teams.c
@@ -63,10 +63,10 @@ typedef struct
 
 struct _GtrDlTeams
 {
-  GtkBin parent_instance;
+  GtkFrame parent_instance;
 };
 
-G_DEFINE_TYPE_WITH_PRIVATE (GtrDlTeams, gtr_dl_teams, GTK_TYPE_BIN)
+G_DEFINE_TYPE_WITH_PRIVATE (GtrDlTeams, gtr_dl_teams, GTK_TYPE_FRAME)
 
 static void team_add_cb (GtkButton *btn, GtrDlTeams *self);
 static void gtr_dl_teams_save_combo_selected (GtkWidget *widget, GtrDlTeams *self);
diff --git a/src/gtr-dl-teams.h b/src/gtr-dl-teams.h
index 25ac83e6..121e86df 100644
--- a/src/gtr-dl-teams.h
+++ b/src/gtr-dl-teams.h
@@ -25,7 +25,7 @@ G_BEGIN_DECLS
 
 #define GTR_TYPE_DL_TEAMS (gtr_dl_teams_get_type())
 
-G_DECLARE_FINAL_TYPE (GtrDlTeams, gtr_dl_teams, GTR, DL_TEAMS, GtkBin)
+G_DECLARE_FINAL_TYPE (GtrDlTeams, gtr_dl_teams, GTR, DL_TEAMS, GtkFrame)
 
 GtrDlTeams* gtr_dl_teams_new         ();
 GtkWidget*  gtr_dl_teams_get_header  (GtrDlTeams *self);
diff --git a/src/gtr-dl-teams.ui b/src/gtr-dl-teams.ui
index c9653d54..322b4401 100644
--- a/src/gtr-dl-teams.ui
+++ b/src/gtr-dl-teams.ui
@@ -2,7 +2,7 @@
 <interface>
   <requires lib="gtk+" version="3.20"/>
   <requires lib="libhandy" version="1.0"/>
-  <template class="GtrDlTeams" parent="GtkBin">
+  <template class="GtrDlTeams" parent="GtkFrame">
     <child>
       <object class="HdyClamp">
         <property name="visible">True</property>
diff --git a/src/gtr-filter-selection.c b/src/gtr-filter-selection.c
index 8c0a1852..9f3be601 100644
--- a/src/gtr-filter-selection.c
+++ b/src/gtr-filter-selection.c
@@ -40,10 +40,17 @@ enum
   LAST_SIGNAL
 };
 
-G_DEFINE_TYPE_WITH_PRIVATE (GtrFilterSelection, gtr_filter_selection, GTK_TYPE_MENU_BUTTON)
+G_DEFINE_TYPE_WITH_PRIVATE (GtrFilterSelection, gtr_filter_selection, GTK_TYPE_BUTTON)
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
+static void
+handle_filter_selection_btn_clicked (GtkButton* btn, gpointer user_data)
+{
+  GtrFilterSelectionPrivate *priv = gtr_filter_selection_get_instance_private (GTR_FILTER_SELECTION(btn));
+  gtk_popover_popup(GTK_POPOVER(priv->popup));
+}
+
 static void
 change_option (GtkListBox         *box,
                GtkListBoxRow      *row,
@@ -140,6 +147,13 @@ gtr_filter_selection_init (GtrFilterSelection *self)
   priv->option = NULL;
   priv->options = NULL;
   gtk_widget_init_template (GTK_WIDGET (self));
+
+  gtk_popover_set_relative_to(GTK_POPOVER(priv->popup),GTK_WIDGET(self));
+  g_signal_connect (self,
+                    "clicked",
+                    G_CALLBACK(handle_filter_selection_btn_clicked),
+                    NULL);
+
   gtk_widget_show_all (priv->option_list);
 
   g_signal_connect (priv->option_list,
diff --git a/src/gtr-filter-selection.h b/src/gtr-filter-selection.h
index 90e77451..e2484698 100644
--- a/src/gtr-filter-selection.h
+++ b/src/gtr-filter-selection.h
@@ -24,11 +24,11 @@ G_BEGIN_DECLS
 
 #define GTR_TYPE_FILTER_SELECTION (gtr_filter_selection_get_type())
 
-G_DECLARE_DERIVABLE_TYPE (GtrFilterSelection, gtr_filter_selection, GTR, FILTER_SELECTION, GtkMenuButton)
+G_DECLARE_DERIVABLE_TYPE (GtrFilterSelection, gtr_filter_selection, GTR, FILTER_SELECTION, GtkButton)
 
 struct _GtrFilterSelectionClass
 {
-  GtkMenuButtonClass parent_class;
+  GtkButtonClass parent_class;
 };
 
 typedef struct
diff --git a/src/gtr-filter-selection.ui b/src/gtr-filter-selection.ui
index 596ab9cb..1dff66d7 100644
--- a/src/gtr-filter-selection.ui
+++ b/src/gtr-filter-selection.ui
@@ -57,12 +57,12 @@
       </object>
     </child>
   </object>
-  <template class="GtrFilterSelection" parent="GtkMenuButton">
+  <template class="GtrFilterSelection" parent="GtkButton" >
     <property name="label" translatable="no">Choose Option</property>
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="receives_default">False</property>
-    <property name="popover">popup</property>
+    <!-- <property name="popover">popup</property> -->
     <child>
       <object class="GtkLabel">
         <property name="visible">True</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]