After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 107617 - Applet background change notification
Applet background change notification
Status: RESOLVED FIXED
Product: gnome-panel
Classification: Other
Component: panel
2.3.x
Other All
: High normal
: ---
Assigned To: Panel Maintainers
Panel Maintainers
new-toplevel-todo
Depends on:
Blocks:
 
 
Reported: 2003-03-05 04:19 UTC by Mark McLoughlin
Modified: 2015-03-24 13:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Draft of a patch (5.42 KB, patch)
2003-10-20 14:43 UTC, Vincent Untz
none Details | Review
Updated patch (10.10 KB, patch)
2003-10-28 17:06 UTC, Vincent Untz
none Details | Review
Updated patch. (12.27 KB, patch)
2003-10-29 00:37 UTC, Vincent Untz
none Details | Review

Description Mark McLoughlin 2003-03-05 04:19:43 UTC
I don't think applet's are being notified of background
changes anymore. Search for "back_change" and figure out how
to fix it. Preferably do it a different way from the old way
which was a bit hacky.
Comment 1 Elijah Newren 2003-03-06 21:45:58 UTC
Is this related to bug 107759?
Comment 2 Mark Finlay 2003-03-09 20:24:09 UTC
Also applets need to be able to inherit transparent backgrounds.
Comment 3 Vincent Untz 2003-10-20 14:43:02 UTC
Created attachment 20818 [details] [review]
Draft of a patch
Comment 4 Vincent Untz 2003-10-20 14:44:16 UTC
Mark: I've written this. Is this ok or not? Is there anything else
that should be done?
Comment 5 Vincent Untz 2003-10-20 15:39:57 UTC
Setting priority to HIGH in order to get someone review the patch :-)
Comment 6 Vincent Untz 2003-10-20 16:06:10 UTC
I forgot this in tha patch:

Index: applet.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/applet.c,v
retrieving revision 1.223
diff -u -r1.223 applet.c
--- applet.c    19 Sep 2003 03:59:43 -0000      1.223
+++ applet.c    20 Oct 2003 16:05:50 -0000
@@ -1145,9 +1145,7 @@
  
        orientation_change (info, panel);
        size_change (info, panel);
-#ifdef FIXME_FOR_NEW_CONFIG
        back_change (info, panel);
-#endif
  
        if (type != PANEL_OBJECT_BONOBO)
                gtk_widget_grab_focus (applet);
Comment 7 Vincent Untz 2003-10-28 17:06:52 UTC
Created attachment 21011 [details] [review]
Updated patch
Comment 8 Vincent Untz 2003-10-28 17:08:48 UTC
The patch nearly works. I did a clock debug window (as in bug #107146)
and I see the background change correctly. The only problem is that it
seems the frame automatically returns to a coloured state (I can see
it with the good background during a tenth of a second). I can't find why.
Comment 9 Mark McLoughlin 2003-10-28 18:03:59 UTC
Vincent: overall the patch looks pretty good - the only bit I really
don't like is making PanelBackground dependant on PanelWidget. I'd
like to maintain that split. How about something like:

typedef void (*PanelBackgroundChangedNotify) 
                           (PanelBackground *background,
                            gpointer         user_data);

void panel_background_init 
         (PanelBackground              *background,
          PanelBackgroundChangedNotify  notify_changed,
          gpointer                      user_data);


One other random nit:

  + We already have a size_allocate handler in panel-applet-frame.c
    so lets re-use that. Something like:

static void
panel_applet_frame_update_background_size 
                  (PanelAppletFrame *frame,
                   GtkAllocation    *old_allocation,
                   GtkAllocation    *new_allocation)
{
  if (old_allocation->x      == new_allocation->x &&
      old_allocation->y      == new_allocation->y &&
      old_allocation->width  == new_allocation->width &&
      old_allocation->height == new_allocation->height)
    return;

  if (background->type == PANEL_BACK_NONE ||
     (background->type == PANEL_BACK_COLOR && !background->has_alpha))
    return;

  panel_applet_frame_change_background (frame);
}

static void
panel_applet_frame_size_allocate (GtkWidget     *widget,
                                  GtkAllocation *allocation)
{
  ..
  GtkAllocation old_allocation;

  old_allocation = *widget->allocation;

  if (!frame->priv->has_handle) {
    GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, 
                                                    allocation);
    panel_applet_frame_update_background_size (widget,
                                               &old_allocation,
                                               allocation);
    return;
  }

  ...

  panel_applet_frame_update_background_size (widget,
                                             &old_allocation,
                                             allocation);
}


Feel free to go ahead after you make those changes.

Its really good to see this finally getting close :-)
Comment 10 Vincent Untz 2003-10-29 00:37:17 UTC
Created attachment 21024 [details] [review]
Updated patch.
Comment 11 Vincent Untz 2003-10-29 00:40:13 UTC
The updated patch was modified after reading Mark's comments.

Mark: I'd appreciate if you could review the changes I made, because
I'm not sure I implemented the PanelBackgroundChangedNotify the way
you wanted it. If it's ok, I'll commit to HEAD. It's too much changes
for gnome-2-4, isn't it?
Comment 12 Vincent Untz 2003-10-29 11:39:14 UTC
Please not that there's a change in panel-toplevel.c that should not
be in the patch.
Comment 13 Mark McLoughlin 2003-10-30 16:33:04 UTC
Patch looks good - as you say, though, the changed_notify bit isn't
exactly how I'd do it:

 void
-panel_background_init (PanelBackground *background)
+panel_background_init (PanelBackground              *background,
+		       PanelBackgroundChangedNotify  notify_changed,
+		       GtkWidget                    *panel)

  + I'd make the last param "gpointer user_data"

+	PanelBackgroundChangedNotify notify_changed;
+	GtkWidget              *panel;

  + and also make this "gpointer user_data;"

+void
+panel_widget_background_changed (PanelBackground *background,
+				 gpointer        panel)
+{
+	g_return_if_fail (PANEL_IS_WIDGET (panel));
+	g_signal_emit (G_OBJECT (panel),
+		       panel_widget_signals [BACK_CHANGE_SIGNAL],
+		       0);

  + make this static and remove the prototype from the header
  + also make the second parameter a PanelWidget and cast the
    function when passing it to panel_background_init - see
    below

-	panel_background_init (&panel->background);
+	panel_background_init (&panel->background,
+			       &panel_widget_background_changed,
+			       widget);

  + no need to take the address of the function i.e.:

  panel_background_init (
    &panel-background,
    (PanelBackgroundChangedNotify) panel_widget_background_changed,
    panel);


Otherwise, looks good. Thanks again :-)
Comment 14 Vincent Untz 2003-11-03 16:26:26 UTC
I committed the patch to HEAD after making the changes you mention.
Now, we need to understand why the applet don't keep the pixmap and
come back to a coloured background. Maybe we should open a new bug for
this...
Comment 15 Kevin Vandersloot 2003-11-29 15:00:18 UTC
I tried to figure out the last few issues to get this working for the
applets. Bug is filed as #128167
Comment 16 Vincent Untz 2003-12-01 07:39:56 UTC
Closing this bug because Kevin's bug is much more useful now.